The Linux Command Reference
A command reference is one list of every command in the course. Each row pairs a command with its job and its lesson.
Find one command
which prints the place of a command. type tells how it runs.
$ cd ~/practice
$ which ls
$ type lsTwo more lookups
tar packs files, and ping checks a connection. The table holds both.
$ cd ~/practice
$ which tar
$ which pingExample
$ cd ~/practice
$ which ls
$ type ls
$ which tar
$ which pingKey points
- An alias gives a long command a short name you can type instead.
- Export marks a variable so new commands can use it.
- The commands sit in the order the course teaches them.
- Use this list when a command slips your mind.
- Every row here has a lesson behind it.
In this example, which finds ls, tar, and ping. type shows ls as a file on the disk. The table above holds the rest.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Every command in this course
| Command | Job | Lesson |
|---|---|---|
| echo | Print words | The Terminal |
| whoami | Print the current user name | Your First Commands |
| hostname | Print the machine name | Your First Commands |
| date | Print the date and time | Your First Commands |
| history | List past commands | Your First Commands |
| man | Show the manual page | Getting Help |
| help | Show help for a command | Getting Help |
| pwd | Print the current folder | Where You Are |
| ls | List files | Where You Are |
| tree | List files as a tree | Where You Are |
| cd | Move to another folder | Moving Around |
| stat | Show the details of a file | Listing Files |
| file | Tell what kind of file it is | Listing Files |
| mkdir | Make a folder | Making Folders |
| rmdir | Remove an empty folder | Making Folders |
| rm | Remove files | Making Folders |
| touch | Make an empty file | Making Files |
| cp | Copy files | Making Files |
| mv | Move or rename files | Making Files |
| cat | Print a whole file | Making Files |
| less | Read a file a page at a time | Reading with Less |
| head | Print the first lines | Head and Tail |
| tail | Print the last lines | Head and Tail |
| wc | Count lines and words | Counting with wc |
| find | Find files by name | Finding Files |
| grep | Find lines with a word | Searching Text |
| which | Show where a command lives | Finding Commands |
| type | Tell how a command runs | Finding Commands |
| env | List the variables | Finding Commands |
| id | Show a user and its groups | Owners and Groups |
| groups | List the groups of a user | Owners and Groups |
| chmod | Change permissions | Changing Permissions |
| chown | Change the owner | Changing Owners |
| chgrp | Change the group | Changing Owners |
| sudo | Run one command as the superuser | Sudo and Root |
| sort | Sort lines | Sorting Lines |
| uniq | Drop repeated lines | Unique Lines |
| cut | Cut out columns | Cutting Columns |
| tr | Swap one letter for another | Replacing Text |
| sed | Swap words in lines | Replacing Text |
| tee | Save output to a file as well | Pipes |
| ps | List processes | Seeing Processes |
| sleep | Wait some seconds | Background Jobs |
| jobs | List background jobs | Background Jobs |
| fg | Bring a job to the front | Background Jobs |
| kill | Stop a process | Stopping Processes |
| top | Watch live processes | Top and System Load |
| uptime | Show the run time and the load | Top and System Load |
| free | Show free memory | Top and System Load |
| who | Show who is signed in | Who Are You |
| useradd | Add a user | Adding Users |
| passwd | Set a user password | Adding Users |
| groupadd | Add a group | Groups |
| usermod | Change the groups of a user | Groups |
| su | Switch to another user | Switching Users |
| userdel | Remove a user | Switching Users |
| groupdel | Remove a group | Switching Users |
| df | Show free disk space | Disk Space |
| du | Show folder sizes | Folder Sizes |
| ln | Make a link | Links |
| tar | Pack files into an archive | Archives |
| gzip | Shrink one file | Archives |
| gunzip | Open a shrunk file | Archives |
| ping | Check a connection | Checking Connections |
| curl | Fetch a page | Fetching Pages |
| wget | Download a page | Fetching Pages |
| ip | Show the machine addresses | Your Address |
| ss | List what the machine listens for | Your Address |
| ssh-keygen | Make a key pair | Secure Shell |
| ssh | Log in to a remote machine | Secure Shell |
| dpkg | List installed packages | Listing Packages |
| apt | Install, list, and remove packages | Listing Packages |
| alias | Give a command a short name | The Linux Command Reference |
| export | Share a variable with new commands | The Linux Command Reference |
Exercise
How do you find the lesson that teaches tar?