10 Must-Know Linux Commands

Syeda Summaiya Wasti
4 min readOct 2, 2021

--

Whether you’re a security professional, any other IT personnel looking to expand your skills into Linux, or a fresh convert to Linux, this introduction to some basic commands is definitely for you. I have listed below 10 commands you should know in order to perform some very basic functions in this OS. No matter how far you have explored this system you will always be using these basic commands.

1. pwd

pwd stands for “print working directory”. This command tells you the directory in which you’re currently working. For Example; pwd in the Downloads directory will show “home/kali/Downloads”.

working directory - downloads

2. ls

This “ls” command will list the files in your current directory. If you simply type ls , you'll see all non-hidden files in your current directory.

files in my current directory

else if you type;

ls -a

folders also printed

now you will see several files beginning with a period. The -a switch or option, as it's called shows you all files, even hidden ones. you can also type

ls -al

files with all their details

and this will lists all hidden files along with details of a file, such as the owner of the file and the permissions assigned to the file.

3. history

This “history” command shows you the history of all commands you have used. This is particularly helpful when you have typed a command for a certain action and forget it, now this will help you remember the command you had typed.

history of all commands I have used

4. mv

This command has two functions

i) It allows you to move a file from one directory to another. General structure for this command is “mv filename directory”. For example if you want to move a file “test.txt” from downloads to desktop, you will type “mv test.txt /home/kali/Desktop”

moving a file to Desktop

ii) Its also used to rename a file. For this just type “mv filename rename”. For example if a file is named as test.txt and you want to rename it as result.txt, you will type “mv test.txt result.txt”.

renaming a file

5. cp

This command is used to copy a file. You can copy a file from a directory and can paste it another one by just typing “ cp filename directory”. For example if a file named as result.txt is in Desktop directory and you want to copy it to Downloads you will write “cp result.txt /home/kali/Downloads”

copying a file to downloads

6. rm

This command is used to delete a file. Just type “rm filename”, and its removed!

removing a file named “result.txt”

You can also remove a directory but for it you have to use a -r flag. Type “rm -r directory” to remove one. Where r stands for recursively. To understand what “recursively” means, think of it this way: to remove the directory and all its files and subdirectories and all their files and subdirectories of the subdirectories and all their files, and on and on, “recursively”.

removing a directory named “sum”

7. find

This command is used when you remember a filename and wants to see whether its still there or you have removed it or moved it to other directory. This is particularly helpful when there are a lot of files in a directory and it would be time consuming to search for a particular one.

Type “find filename” to find one.

finding a file named “result.txt”

8. man

Linux has a large set of online documentation for reference. They’re called as manual pages, as in read the manual. The command for referencing this documentation is “man command” and a screen-full of information appears before you.

For example; to check the whole manual of ls command type “man ls”. To quit the extensive manual press “q”.

manual for command “ls”

9. clear

To clear the terminal window type “clear”

10. exit

To exit the terminal window type “exit”

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Syeda Summaiya Wasti
Syeda Summaiya Wasti

Written by Syeda Summaiya Wasti

A software engineering student and cyber security enthusiast.

Responses (1)

Write a response