Back

20 Essential Linux commands you should know

20 Essential Linux commands You Should Know


The Linux operating system is known for its versatility, flexibility, and efficiency, widely used in personal computers, servers, and various other areas. Every user should know these basic Linux commands as they are essential for performing most system tasks. In this tutorial, you will learn 20 of the most important Linux commands to help you administer Unix systems more easily.


1. ls - "List files"

Displays files and directories within a directory. Using the -l option provides more detailed information (file size, date, permissions):

ls -l


2. cd - "Change directory"
Changes the current working directory:
cd /home/user/Documents

3. pwd - "Print working directory"
Shows the path of the current directory:
pwd

4. mkdir - "Make directory"
Creates a new directory:
mkdir NewFolder

5. rm - "Remove"
Deletes files or directories. To remove a file:
rm failas.txt
To remove a directory, use the -r option (recursive deletion):
rm -r aplankas/

6. cp - "Copy"
Copies files from one directory to another. To copy a file:
cp file.txt copy.txt
To copy a directory, add the -r option (recursive copy):
cp -r folder1 folder2

7. mv - "Move"
Moves or renames files and directories. To move a file "file.txt" to the directory "folder":
mv file.txt folder/
To rename a file:
mv oldname.txt newname.txt

8. touch
Creates a new empty file or updates the timestamp of an existing file:
touch newfile.txt

9. cat - "Concatenate"
Displays file content in the terminal:
cat file.txt

10. nano
Terminal-based text editor for viewing and editing files:
nano file.txt
To save the file: Press CTRL + X, then Y, and then Enter.

11. grep
Searches for text in a specified file:
grep "text" file.txt
To recursively search for specific text in all files and subdirectories, add -r option (recursive search):
grep -r "tekstas"

12. find
Searches for files and directories based on various criteria. To find a specific file:
find . -type f -name "file.txt"
To find a directory:
find . -type d -name "folder"

13. sudo - "Super user do"
Executes commands with administrator privileges. Regular users needing elevated permissions prepend "sudo" to any command:
sudo apt update

14. apt - "Advanced package tool"
Package management tool for Debian and Ubuntu systems used for installing and updating software packages.
To install a program:
sudo apt install program
Or to upgrade packages:
sudo apt upgrade

15. tar - "Tape archiver"
Creates and extracts archives. To archive a directory:
tar -cvf archive.tar folder/
To extract an archive:
tar -xvf archive.tar

16. chmod - "Change mode"
Changes file and directory permissions:
chmod 755 file.txt

17. ps - "Process status"
Shows running processes:
ps aux

18. kill
Terminates a process based on its ID:
kill 12345

19. df - "Disk free"
Displays disk usage statistics:
df -h

20. history
Displays previously executed commands:
history

We hope these commands will help you efficiently handle various tasks on Linux operating systems. If you encounter issues or have questions, please contact our live support or email us at [email protected].



Similar tutorials

How to Allow Remote Access to MySQLRemote access to MySQL lets you administer and use databases from another computer or application outside the server.  This...

Read

How to Install Java on a VPS Server If you’ve ever tried to run a Minecraft server on Linux or any other application that requires...

Read
VPS Tutorials
For a consultation, please contact us by email:
[email protected]