We’re going to download a file and uncompress it. To do that, we’ll learn a few commands related to:
Print to display →.
Think: an echo repeats what you say
echo say this again
Clear screen →
(obvs). Bring prompt up to top so that it looks like you have a clear screen (you can still scroll up).
clear
Interrupt or stop a running command →
Think cancel. It’s the control key and the lowercase c key together.
[CONTROL] + [c]
Download a file and display file. →
(Requires one argument, the URL of the page you’d like to display.)
curl http://someurl.com
Download a file and save it. →
curl -o filename.txt http://someurl.com
(the -o flag should be followed by the name of the file you want the URL to be saved as)
curl -o filename.txt http://someurl.com
Uncompress a zip file. Works on files with a .zip extension. →
unzip filename1.zip
(Requires one argument - the name of the file you want to uncompress)
Archive directories and files. →
Think: T-archive, compress
tar -cvf archivename.tar directory_to_compress
(tar requires one argument, the directory to compress… and the -f flag requires the name of the resulting archive)
Uncompress and unarchive a tarball. Works on files with a .tar.gz extension. →
Think: t-archive, xtract
tar -xvf archivename.tar.gz
(exactly one argument, the name of the files to unarchive)
Compress a file. →
Think: zip
gzip filename.txt
(exactly one argument, the name of the files to compress)
Entering commands flash cards x 5 (use set 2)
We’ll do this together, then try downloading it yourself:
Output, Download and Uncompress
Entering commands flash cards x 3 (use set 12)
We’ll do this together, then try downloading it yourself: