20 Linux commands for newbies

The Command Line can be daunting - so arm yourself!

by Pete
Published: Updated: 7 minutes read

Hey there Linux enthusiasts! Are you a newbie looking to beef up your command line skills? Look no further! We’ve compiled a list of the top 20 most important Linux commands that every newbie should know. From navigating the file system to managing files and directories, these commands will have you feeling like a command line pro in no time. But don’t just take our word for it, try them out for yourself and see the magic unfold.

Let’s get into it

Trust us, once you master these commands, you’ll be navigating the Linux world like a boss. So, let’s get ready to “ls” and “cd” our way to command line mastery! Note: The Linux command line is case sensitive!

1
ls – lists the files and directories in a directory

Tip: (Tack on ‘-la’ to display a long list, and to include to all entries)

ls -la /home/pfarmer/

2
cd – changes the current working directory

cd /home/pfarmer/Documents/

3
mkdir – creates a new directory

Tip: If you’re in the Documents folder, you don’t need to specify the entire folder structure – this is just and example. But if you’re in another folder, you can use specify the entire structure to create folder elsewhere.

mkdir /home/pfarmer/Documents/newfolder

4
rmdir – removes an empty directory

rmdir /home/pfarmer/Documents/newfolder

5
touch – creates a new empty file

touch /home/pfarmer/Documents/newfolder/touchedfile.txt

6
cp – copies a file or directory

cp /home/pfarmer/Documents/file.txt /home/pfarmer/Documents/backup/file.txt

7
mv – moves or renames a file or directory

Tip: If you’re in the same directory as the file, you don’t need to specify the entire folder structure, just the filename. I’m just listing out the folder structure as an example.

mv /home/pfarmer/Documents/file.txt /home/pfarmer/Documents/backup/file.txt

8
rm – deletes a file or directory

rm /home/pfarmer/Documents/oldfile.txt

9
pwd – shows the current working directory

pwd

10
man – displays the manual page for a command

man ls

11
echo – outputs the string passed as argument

Tip: Useful in BASH scripts.

echo "Hello, LinuMO!"

12
cat – concatenates and displays the content of files

cat file.txt

13
grep – searches for a pattern in a file or a stream of text

Tip: where the “pattern” is what you want to search for as per the example below.

grep "pattern" file.txt

14
find – search for files in a directory hierarchy

Tip: You might need “sudo” before find on some OSes that require elevated privileges or you might face permission denied depending on where you’re searching.

find / -name "file.txt"

15
chmod – changes the file permissions

Tip: In this example, we’re making the script “scrip.sh” executable my changing the “executable” permission to on.

chmod +x script.sh

16
chown – changes the file ownership

chown user:group file.txt

17
sudo – allows a user to run commands with superuser privileges

sudo apt-get update

18
apt-get or yum – package management commands

apt-get install package-name

or

yum install package-name

19
ps – displays the currently running processes

Tip: using the’-ef’ will show you every process running on the system.

ps -ef

20
kill – sends a signal to a process to terminate it

Tip: use ‘ps’ to show you the Process ID (or PID). Alternatively, you can use the command ‘htop’ to display AND kill processes.

kill -9 1234 (where 1234 is the process ID)

In Summary

Mastering the command line is a crucial step in becoming a Linux pro. We hope that this list of the top 20 most important Linux commands for newbies was helpful in your journey to command line mastery. From navigating the file system to managing files and directories, these commands will make your life a lot easier. Remember to keep experimenting with these commands and don’t be afraid to explore other command options. And always refer to the manual page of a command with man command. Practice makes perfect, and before you know it, you’ll be navigating the Linux world like a pro!

Follow up Reading

There are many MANY places to find this information. I recommend try these sites for further reading: