Extract the contents from archive.tar.gz in the current directory
|
|
$ tar xzvf archive.tar.gz
|
|
Download a file from web with wget
|
|
$ wget https://raw.githubusercontent.com/svenfuchs/rails-i18n/master/rails/locale/en.yml
|
|
Download a file with basic authentication using wget (both HTTP and FTP)
|
|
$ wget --user=USERNAME --password=PASS https://xxxx
|
|
Perform basic DNS lookups with the specified name server (e.g. 8.8.8.8 )
|
|
$ dig @8.8.8.8 www.wazaterm.com
|
|
Find files modified in the last 10 days from current directory and show the detailed list
|
|
$ find . -mtime -10 -ls
|
|
Print all system information
|
|
$ uname -a
|
|
Print kernel release information
|
|
$ uname -r
|
|
Display how long the system has been running and load
|
|
$ uptime
|
|
How to PUT JSON with curl
|
|
$ curl -X PUT -H "Content-Type: application/json" -d '{"id": "1", "key": "value"}' localhost:3000/api/v1/users
|
|
Authenticate with JWT token using curl
|
|
$ curl -X POST -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" -d '{"id": "1"}' localhost:3000/api/v1/users
|
|
How to prevent SSH from timing out
|
|
$ ssh -o "ServerAliveInterval 60"
|
|
Check listening ports with netstat
|
|
$ sudo netstat -tunlp
|
|
Copy home directory - Copy the content of /home/username to current directory (assuming you are in /home/username)
|
|
$ rsync -avz username@s15.wazaterm.com:/home/username/ .
|
|
Create a tar archive file archive.tar for a directory backup in current working directory
|
|
$ tar cvf archive.tar ./backup/
|
|
Extract the contents from archive.tar in the current directory
|
|
$ tar xvf archive.tar
|
|
Extract the contents from archive.tar in /tmp directory
|
|
$ tar xvf archive.tar -C /tmp
|
|
Add execute permission to foo.sh
|
|
$ chmod u+x foo.sh
|
|
Change the owner of the file, foo.txt, to root
|
|
$ chmod root foo.txt
|
|
Change the owner of the file, foo.txt, to root and the group owner to sudousers
|
|
$ chmod root:sudousers foo.txt
|
|
Change the owner of the files to root against files under the directory, linux, recursively
|
|
$ chown -R root linux/
|
|
Display all of the messages in the ring buffer
|
|
$ dmesg
|
|
Display device info as the human-readable output
|
|
$ dmesg -H
|
|
Search for SPF records
|
|
$ dig wazaterm.com txt
|
|
Perform IPv6 DNS lookups
|
|
$ dig AAAA dns.google
|
|
Get hostname from IP Address(Reverse lookup)
|
|
$ dig -x 8.8.8.8
|
|
Check MX record of the domain
|
|
$ dig gmail.com MX
|
|
Perform basic DNS lookups
|
|
$ dig www.wazaterm.com
|
|
Check if a host is up with IPv6 address
|
|
$ ping -6 www.google.com
|
|
Check whether a remote host is up with 3 seconds interval and 5 times
|
|
$ ping -c 5 -i 3 www.google.com
|
|
Show unixtime
|
|
$ date +%s
|
|