25 basic Linux terminal commands to remember

On Linux, the command-line is a powerful tool. Once you understand how to use it, it’s possible to accomplish a whole lot of advanced operations really fast. Sadly, new users find the Linux command-line confusing, and don’t know where to start.

In an effort to educate new users on the Linux command-line, we’ve made a list of 25 basic Linux terminal commands to remember. Let’s get started!

1. ls

ls is the list directory command. In order to use it, launch a terminal window and type the command ls.


The ls command can also be used to reveal hidden files with the “a” command line switch.

ls -a

2. cd

cd is how you change directories in the terminal. To swap to a different directory from where the terminal started, do:

cd /path/to/location/

It is also possible to go backwards up a directory by using “..”.

cd ..

3. pwd

To show the current directory in the linux terminal use the pwd command.


4. mkdir

If you’d like to create a new folder, use the mkdir command.


To preserve the permissions of the folder to match the permissions of the directory that came before it, use the “p” command line switch.

mkdir -p name-of-new-folder

5. rm

To delete a file from the command line, use the rm command.

rm /path/to/file

rm can also be used to delete a folder if there are files inside of it by making use of the “rf” command line switch.

rm -rf /path/to/folder

6. cp

Want to make a copy of a file or folder? Use the cp command.

To copy a file, use cp followed by the location of the file.

cp /path/to/file

Or, to copy a folder, use cp with the “r” command line switch

cp -r /path/to/folder

7. mv

The mv command can do a lot of things on Linux. It can move files around to different locations, but it can also rename files.

To move a file from one location to another, try the following example.

mv /path/to/file /place/to/put/file|

If you want to move a folder, write the location of the folder followed by the desired location where you’d like to move it.

mv /path/to/folder /place/to/put/folder/

Lastly, to rename a file or folder, cd into the directory of the file/folder you’d like to rename, and then use the mv command, for example:

mv name-of-file new-name-of-file

Or, for a folder, do:

mv name-of-folder new-name-of-folder

8. cat

The cat command lets you view the contents of files in the terminal. To use cat write the command out followed by the location of the file you’d like to view. For example:

cat /location/of/file

9. head

Head lets you view the top 10 lines of a file. To use it, enter the head command followed by the location of the file.

head /location/of/file

10. tail

Tail lets you view the bottom 10 lines of a file. To use it, enter the tail command followed by the location of the file.

tail /location/of/file

11. ping

On Linux, the ping command lets you check the latency between your network and a remote internet or LAN server.



ping IP-address

To ping only a few times, use the ping command followed by the “c” command line switch and a number. For example, to ping Google 3 times, do:

ping -c3

12. uptime

To check how long your Linux system has been online, use the uptime command.


13. uname

The uname command can be used to view your current distribution codename, release number, and even the version of Linux you are using. To use uname, write the command followed by the “a” command line switch.

Using the “a” command line switch prints out all information, so it’s best to use this instead of all other options.

uname -a

14. man

The man command lets you view the instruction manual of any program. To take a look at the manual, run the man command followed by the name of the program. For example, to view the manual of cat, run:

man cat

15. df

Df is a way to easily view how much space is taken up on the file system(s) on Linux. To use it, write the df command.


To make df more easily readable, use the “h” command line switch. This puts the output in “human readable” mode.

df -h

16. du

Need to view the space that a directory on your system is taking up? Make use of the du command. For example, to see how big your /home/ folder is, do:

du ~/

To make the du output more readable, try the ‘hr” command-line switch. This will put the output in “human readable” mode.

du ~/ -hr

17. whereis

With whereis, it’s possible to track down the exact location of an item in the command-line. For example, to find the location of the Firefox binary on your Linux system, run:

whereis firefox

18. locate

Searching for files, programs and folders on the Linux command-line is made easy with locate. To use it, just write out the locate command, followed by a search term.

locate search-term

19. grep

With the grep command, it’s possible to search for a pattern. A good example use of the grep command is to use it to filter out a specific line of text in a file.

Understand that grep isn’t a command that should ever be run by itself. Instead, it must be combined, like so:

cat text-file.txt | grep 'search term'

Essentially, to use grep to search for patterns, remember this formula:

command command-operations | grep 'search term'

20. ps

To view current running processes directly from the Linux terminal, make use of the ps command.


Need a more full, detailed report of processes? Run ps with aux.

ps aux

21. kill

Sometimes, you need to kill a problem program. To do this, you’ll need to take advantage of the kill command. For example, to close Firefox, do the following.

First, use pidof to find the process number for Firefox.


Then, kill it with the kill command.

kill process-id-number

Still won’t close? Use the “9” command-line switch.

kill -9 process-id-number

22. killall

Using the killall command, it’s possible to end all instances of a running program. To use it, run the killall command followed by the name of a program. For example, to kill all running Firefox processes, do:

killall firefox

23. curl

Need to download a file from the internet through the Linux terminal? Use curl! To start a download, write the curl command followed by the file’s URL, the > symbol and the location you’d like to save it. For example:

curl > ~/Downloads/

24. free

Running out of memory? Check your swap space and free RAM space with the free command.


25. chmod

With chmod, it’s possible to update the permissions of a file or folder.

To update the permissions of a file so everyone on the PC can read, write and execute it, do:

chmod +rwx /location/of/file-or/folder/

To update the permissions so only the owner has access, try:

chmod +rw

To update permissions for a specific group or world on the Linux system, run:

chmod +rx


The Linux command-line has endless actions and operations to know, and even after getting through this list, you’ll still have a lot more to learn. That said, this list is sure to help beef up your command-line knowledge. Besides, everyone has to start somewhere!

Related posts

How to automatically empty the trash on Linux

The trash feature on many Linux distributions is a lot like the “Recycle bin” on Microsoft Windows, or the feature of the…

Set Up a Firewall with GUFW on Linux Desktop

UFW (Uncomplicated Firewall) is a simple to use firewall utility with plenty of options for most users. It is an interface for…

How To Find a Stolen Mac And Protect Data From Theives

If your Mac’s been stolen or you’ve left it somewhere there is some pretty nifty Apple technology that can help you find…

Leave a Reply

Your email address will not be published. Required fields are marked *