DEV Community


15 Must Know Linux Commands For Beginners

aadityajha2004 profile image Aaditya ・4 min read

Believe it or not, one of the most frequent thing you will be doing in Linux is using command line tools. It(Terminal) may look scary but is one of the most powerful part of Linux. And let’s be honest, its just looks cool to work on terminal. So, here are top 15 must know commands in Linux(in no specific order).

1. pwd and ls

Yes, they are 2 different commands but are really very commonly used and simple.
pwd(present working directory) is used to print the address of the current directory you are working in.

user@user:~$ pwd

ls command list all the files present in the working directory. You can use ls -a to list hidden files/folders also and ls /directory to list files/folders under a specific directory.

user@user:~$  ls
Desktop    Downloads  Music     Public  Templates  websites
Documents  hts-cache  Pictures  snap    Videos
user@user:~$ ls -a
.              Documents     .ICEauthority     snap
..             Downloads     .local            .ssh
.bash_history  .gconf        .mozilla          .sudo_as_admin_successful
.bash_logout   .gimp-2.8     Music             Templates
user@user:~$ ls /etc
acpi                           hosts.deny           popularity-contest.conf
adduser.conf                   hp                   ppp
alternatives                   ifplugd              printcap
anacrontab                     ImageMagick-6        profile
apache2                        init                 profile.d
apg.conf                       init.d               protocols
apm                            initramfs-tools      pulse

2. mkdir and rmdir

mkdir is used to make a new directory in the current working directory or you can specify another directory where you want to create a folder.

user@user:~$ mkdir new
user@user:~$ mkdir Desktop/new

rmdir is used to remove a folder. To remove a file use rm command. To remove a folder containing multiple files use rm -r filename.

user@user:~$ rmdir new
user@user:~$ rm new.txt
user@user:~$ rm -r Documents

3. cp and mv

cp command is used to copy the files and folders from one location to another.
mv command is used to move the files and folders from location to other.

user@user:~$ cp targetfile destination
user@user:~$ mv targetfile destination

4. touch

touch command is used to create a file in a specific location. If no location is specified, it will by default make the file in current working directory.

user@user:~$ touch file.txt
user@user:~$ touch Desktop/file.txt

5. sudo

Short for “SuperUser Do”, this command enables you to perform tasks that require administrative or root permissions. However, it is not advisable to use this command for daily use because it might be easy for an error to occur if you did something wrong.
user@user:~$ sudo <command>

6. cat

The cat command serves two very important functions: concatenating (merging) files (as the name suggests) and printing the contents of a file to the screen. Printing the contents of files is by far the more frequent use of this command.

If you want to see a file's contents, use the following format:

user@user:~$ cat filename

To concatenate files, the format is:

user@user:~$ cat file1 file2 > newFileName

7. man

To know more about a command and how to use it, use the man command. It shows the manual pages of the command.
user@user:~$ man mkdir
This gives the manual page for mkdir command.

8. du and df

If you want to check how much space a file or a directory takes, the du (Disk Usage) command can be used. However, the disk usage summary will show disk block numbers instead of the usual size format. If you want to see it in bytes, kilobytes, and megabytes, add the -h argument to the command line.

user@user:~$ du
user@user:~$ du -h

Use df command to get a report on the system’s disk space usage, shown in percentage and KBs. If you want to see the report in megabytes, type df -m.

user@user:~$ df
user@user:~$ df -m

9. diff

Short for difference, the diff command compares the contents of two files line by line. After analyzing the files, it will output the lines that do not match. Programmers often use this command when they need to make program alterations instead of rewriting the entire source code.
The simplest form of this command is:
user@user:~$ diff _file1.txt_ _file2.txt_

10. ping

Use ping to check your connection to a server.
Ex: If you type ping it checks if it can connect to the server and come back. The use of this command for simple users is to check your internet connection. If it pings the Google server (in this case), you can confirm that your internet connection is active!

11. lshw

The lshw command will print detailed information about your hardware like cpu, memory, graphics card, and so on. You should run this command with sudo.
user@user:~$ sudo lshw

12. zip and unzip

Use zip to compress files into a zip archive, and unzip to extract files from a zip archive. It has a plenty of options but for basic zipping & unzipping, you can use the format:

user@user:~$ zip -r folder1 folder2 ……
user@user:~$ unzip

Note: -r flag is used to perform a task recursively. In genral, you want to use this flag if your file is not empty(which is genrally the case).

13. history

When you’ve been using Linux for a certain period of time, you’ll quickly notice that you can run hundreds of commands every day. Running history command is useful if you want to review the commands you’ve entered before.

14. echo

This command is used to move some data into a file. For example, if you want to add the text, “Hello, my name is John Doe” into a file called name.txt, you would type:
user@user:~$ echo Hello, my name is John Doe >> name.txt

15. top

The top command will display a list of running processes and how much CPU each process uses. It display the processes in descending order(high to low) of their memory usage. It’s very useful to monitor system resource usage, especially knowing which process needs to be terminated because it consumes too many resources.


These are some of the most frequently used and important linux commands but by no means the only commands. There are endless numbers of these commands but you don’t need to learn all at once. You will get exposed to these commands as you need them. Just be curious and never stop learning.


Editor guide
alekseiberezkin profile image
Aleksei Berezkin

Encountered one day and found it very helpful. Is like man but short and is focused on practical most needed cases

aadityajha2004 profile image
Aaditya Author

Oh Thanks. Really helpful and probably better than man for beginners