A system administrator manages configuration, upkeep and reliable operations of computer operations. Sysadmin handles servers, has to manage system performance and security without exceeding the budget to meet users need.
A system administrator only deals with terminal interface and hence it is very important to learn and become master in commands to operate from terminal.
Uptime
The uptime command tells us how long a system has been running.
folaukaveinga@Folaus-MacBook-Pro-3 sidecar-api-partner % uptime 18:34 up 19:47, 4 users, load averages: 3.05 2.49 2.30
From the left, it shows,
WGET
wget is used to download files onto the current directory.
wget {url}
folaukaveinga@Folaus-MacBook-Pro-3 Downloads % wget google.com --2020-11-09 21:31:28-- http://google.com/ Resolving google.com (google.com)... 2607:f8b0:400f:805::200e, 172.217.11.238 Connecting to google.com (google.com)|2607:f8b0:400f:805::200e|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://www.google.com/ [following] --2020-11-09 21:31:28-- http://www.google.com/ Resolving www.google.com (www.google.com)... 172.217.2.4, 2607:f8b0:400f:800::2004 Connecting to www.google.com (www.google.com)|172.217.2.4|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: ‘index.html.1’ index.html.1 [ <=> ] 12.62K --.-KB/s in 0s 2020-11-09 21:31:30 (88.6 MB/s) - ‘index.html.1’ saved [12918]
wget -o {filename} {url}
To save file with a different name option O can be used.
wget -o google.html google.com
Download a whole website for local use
wget --mirror -p --convert-links -P {path} {url} // example. wget --mirror -p --convert-links -P ./yourtimer https://yourtimer.io
–mirror – it enables the options suitable for mirroring
-p – download all files which are necessary to display html page
–convert-links – after downloading, convert links into documents for local viewing
-P ./ local dir ? save whole website in the specified local directory.
wget –tries={number} {url}
By default, wget command tries 20 times to downlod a file. This problem generally come when a large file is getting downloaded and internet connection is weak.
Here, you can set number of attempts which wget should make to download a file.
wget -O yourtimer.html --tries=10 https://yourtimer.io
SFTP
SFTP to a server with ssh key.
sftp -o IdentityFile={ssh-private-key} user@host
folaukaveinga@Folaus-MacBook-Pro-3 ~ % sftp -o IdentityFile=~/.ssh/testa/server_ssh_key ubuntu@qa.testa.com Connected to qa.testa.com. sftp> ls testa.sql sftp> // use quit or ! to exit
sftp upload
PUT {filename}
sftp> PUT test.txt // upload multiple tiles sftp> MPUT *.txt
sftp download
GET -p {remoteFile} {localFilename}
sftp> GET -p bin-deploy.sh bin.sh // download multiple files sftp> MGET -p *.txt