- 01Getting Started
- 02What Is a Terminal?
- 03Checking Where You Are with pwd
- 04Checking Contents with ls
- 05Seeing Hidden Files Too with ls -la
- 06Moving Around with cd
- 07Creating a Folder with mkdir
- 08Creating a File with touch
- 09Viewing a File's Contents with cat
- 10Displaying and Writing Text with echo
- 11Searching Text with grep
- 12Copying and Moving with cp / mv
- 13Deleting with rm (Use Caution!)
- 14Checking Who You Are with whoami
- 15Changing File Permissions with chmod
- 16Finding Files with find
- 17Viewing Part of a File with head/tail
- 18Counting Lines & Characters with wc
- 19Viewing Running Processes with ps
- 20Ending a Process with kill
- 21Checking Free Disk Space with df
- 22Checking a Folder's Usage with du
- 23Sorting a File's Lines with sort
- 24Merging Duplicate Lines with uniq
- 25Extracting a Column with cut
- 26Viewing Command History with history
- 27Reading a Command's Manual with man
- 28Creating a Symbolic Link with ln -s
- 29Bundling Files with tar
- 30Replacing Text in a File with sed
- 31Finding a Command's Location with which
- 32Setting Environment Variables with export
- 33Checking Environment Variables with printenv
- 34Giving a Command a Nickname with alias
- 35Extracting a Column with awk
- 36Checking System State with top
- 37Making a Request to a URL with curl
- 38Checking a Server's Reachability with ping
- 39Connecting to a Remote Server with ssh
- 40Changing a File's Owner with chown
- 41Comparing Two Files with diff
- 42Checking the Current Date and Time with date
- 43Checking Your Computer's Name with hostname
- 44Replacing Characters with tr
- 45Displaying with Line Numbers Using nl
- 46Extracting Just the Filename with basename
- 47Extracting Just the Folder Part with dirname
- 48Generating a Sequence with seq
- 49Checking Your User Info with id
- 50Checking Memory Usage with free
- 51Checking Server Uptime with uptime
- 52Doing Simple Math with expr
- 53Listing Environment Variables with env
- 54Checking a File's Details with stat
- 55Repeating a String with yes
- 56Creating Nested Directories at Once with mkdir -p
- 57Clearing Command History with history -c
- 58Checking a Command's Type with type
- 59Reversing Text with rev
- 60Formatting Output with printf
- 61Making Usage Human-Readable with du -h
Bundling Files with tar
tar is for when "I want to bundle several files together and compress them." tar stands for tape archive, and it bundles multiple files into a single archive file, optionally compressing them at the same time.
Use it in the form tar -czf output-name.tar.gz target-files.... -c means create, -z means gzip-compress, and -f specifies the output filename.
Running tar -czf archive.tar.gz notes.txt fruits.txt bundles and compresses both files into a single file, archive.tar.gz.
A common early mistake is confusing the compress flags (tar -czf) with the extract flags (tar -xzf), and doing the opposite of what you meant. Remember: c is create, x is extract.
In real work, this is used constantly — packaging a set of files for server deployment, and as a standard format for saving backup data.
🧑💻 You can type this command into the Linux pseudo terminal to try it yourself (this page itself has no interactive terminal).
