Exploring the Most Popular Commands in Linux

Vitalii Shloda
2 min readJul 13, 2023

--

Linux, a free and open-source operating system, is loved by developers and system administrators for its flexibility, control, and scripting capabilities. It might appear complex, but once you understand the command line basics, navigating Linux becomes a breeze. This article will introduce some of the most popular Linux commands with examples to make your journey smoother.

ls
ls is used to list the contents of a directory.

ls /home/user

This command lists all the files and directories present in the /home/user directory.

cd
cd is used to change the current directory.

cd /home/user/Documents

This command changes the current working directory to /home/user/Documents.

pwd
pwd (print working directory) displays the full pathname of the current working directory.

pwd

This command will display the current working directory.

touch
touch is used to create a new empty file.

touch file.txt

This command will create a new file named file.txt in the current directory.

cp
cp is used to copy files and directories.

cp source.txt destination.txt

This command copies the content of source.txt into destination.txt. If destination.txt does not exist, it will be created.

mv
mv is used to move or rename files.

mv old.txt new.txt

This command renames the file old.txt to new.txt.

rm
rm is used to remove files or directories.

rm file.txt

This command deletes the file.txt file.

cat
cat is used to display the contents of files, concatenate files, and create new ones.

cat file.txt

This command displays the content of file.txt.

echo
echo is used to output the text or value of a variable.

echo Hello, World!

This command will output the string “Hello, World!”.

grep
grep is used for pattern searching in files using regular expressions.

grep 'text' file.txt

This command will search for the word ‘text’ in the file file.txt and output the lines where the pattern is found.

chmod
chmod is used to change the permissions of a file or directory.

chmod 755 script.sh

This command changes the permissions script.sh to 755 (read, write, and execute permissions for the user, and read and execute permissions for group and others).

sudo
sudo (superuser do) is used to execute a command with root privileges.

sudo apt-get update

This command updates the list of available packages and their versions but does not install or upgrade any packages.

The power of Linux lies in its command-line interface. Familiarizing yourself with these common commands is an essential step toward mastery. Remember, these commands only scratch the surface of what you can achieve with Linux, and there are countless more to explore. Happy learning!

--

--

Vitalii Shloda
Vitalii Shloda

Written by Vitalii Shloda

Software Engineer. I write about backend, data and other amazing stuff