Top 20 Basic Commands in Linux for Beginners

With this tutorial, you will learn 20 basic commands in Linux for beginners that will allow you to get a power-packed experience out of Linux. Linux desktops come with evolved desktop environments now and there’s less need than ever to use the terminal, but the terminal is still the most powerful interface for Linux.

Cybersecurity, hacking, forensics, and other forms of advanced computing require that you have a sound knowledge of Linux commands. The terminal allows you to do things that are not even possible with a graphical interface. So this is a beginner-friendly tutorial on how to use these commands in real-life situations.

Getting Started with Terminal

First, open up the terminal by searching it in the application list.

The tilde symbol ( ~ ) shows we’re in the user’s home folder. Tilde is a shortcut that always refers to the current user’s home directory. This section in blue will also show the path of whatever folder you’re currently in.

The dollar sign prompt means the shell is ready to accept your typed commands. You can type --help after almost any command to get usage info about it.

Let’s dive into basic commands in Linux for beginners…

#1. pwd

Use the pwd command to find out the path of the current working directory (folder) you’re in. It’ll return an absolute path to the terminal.

“pwd” stands for print working directory. It’s a simple and informative command. Check out an example.

Using pwd
basic commands in linux for beginners
basic commands in linux for beginners

An example of an absolute path is /home/linuxtalks

#2. ls

Use the ls command to view the contents of a directory.



By itself, this command will display the contents of your current working directory.

If you want to see the contents of other directories, use ls with the directory’s path.

Fun fact: you can use ls -a to show hidden files.

Look at an example.

Using ls
basic commands in linux for beginners
basic commands in linux for beginners

#3. cd

Use the cd command to move through Linux files and directories. This requires either the full path or the name of the directory.

Fun fact: you can use cd .. to move up 1 directory, cd - to go down 1, and cd to go to your home directory.

Check out an example.

Using cd
basic commands in linux for beginners
basic commands in linux for beginners

To learn more about CD and LS commands also read this tutorial:
Using CD, LS Navigation Commands in Linux

#4. echo

Use echo "sometext" > filename command to direct-write into a file (file will be created automatically if it doesn’t exist).



#5. cat

cat is used to list the contents of a file. To run this command, type cat followed by the file’s name and its extension.

Fun fact: you can use cat > newfilename to create a new file and write in it. Press Ctrl+C to save and exit.

Look at an example below to understand using of echo and cat commands.

Using cat and echo
basic commands in linux for beginners
basic commands in linux for beginners

#6. mkdir

mkdir is used to make a new directory. So, if you type: mkdir FavoriteMusic, it’ll create a directory called “FavoriteMusic”.

Fun fact: to generate a new directory INSIDE another directory use this layout mkdir Music/Newdirectory

Here’s an example of mkdir

using mkdir
basic commands in linux for beginners
basic commands in linux for beginners

#7. cp

Use the cp filename destination command to copy files from the current directory to a different directory.

Check out an example.



using cp
basic commands in linux for beginners
basic commands in linux for beginners

#8. mv

The mv filename destination command is usually used to move files, but it can also be used to rename files.

Moving a file to a new directory can be done in the same way as the cp command.

#9. rm

The rm command is used to delete directories and the contents within them. If you only want to delete the directory, use rm -r or rmdir

This is irreversible, so be careful what directories you delete.

Here’s an example below

Using rm and rmdir
basic commands in linux for beginners
basic commands in linux for beginners

#10. touch

The touch command lets you create a blank new file through the Linux command line. it’s super easy!

Check out an example.

Using touch
basic commands in linux for beginners
basic commands in linux for beginners

#11. grep

The command grep lets you search through all the text in a given file for certain words.



Usage: grep keyword ~/Desktop/filename.txt

Learn Linux Quickly: A Friendly Guide to Easily Master the World’s Most Powerful Operating System

#12. man

Use man command to show the manual of any package.

eg: man nano

#13. cal

Use cal to view calendar.

#14. date

Shows current date, time, and timezone.

#15. sed

sed is a powerful text stream editor. Can do insertion, deletion, search and replace. See below example.

sed 's/unix/linux/' myfile.txt

The above simple sed command replaces the word “unix” with “linux” in the myfile.txt.



Using sed --help gives you an idea of how to use the sed command.

#16. [some command] > filename

Use this layout to save command output in a file.

eg:

  • pwd > file.txt (here file.txt file will be filled with your current working directory)
  • date > file.txt (here file.txt file will be filled with your current date, time, and timezone)

#17. sudo [some command]

Sudo, the one command to rule them all. It stands for “super user do!”. It will run any command with root privileges. This will require admin password.

eg:

  • sudo apt install python3 (This will install Python 3 on your operating system)
  • sudo apt update && sudo apt upgrade -y (This will automatically download and update your packages to the latest version available)
  • sudo su (This will open the root terminal)

#18. history

Use history command to show previously used commands or to get information about the commands executed by a user.

#19. clear

Use clear command to clear the terminal screen.

#20. exit

Close terminal with this command.

Wrapping Up

You made it to the end! Thank you for reading. So, Linux doesn’t end here. If you want to learn more Linux commands or Linux in-depth then there are many great courses for beginners in the platform called Skillshare.

Skillshare is my go-to place because Skillshare’s online learning platform empowers you to learn new skills and accomplish real growth. This is the best approach to learn or explore new skills, including Linux.

Sign up on Skillshare for Free!

If this tutorial helped you, sharing this on social media would mean so much to me.

Learn Linux Quickly: A Friendly Guide to Easily Master the World’s Most Powerful Operating System

So that’s just about everything you need to know to basic commands in linux for beginners – I believe you have found them as reminders and helpful. In addition to the ones in this tutorial, if you have any other basic commands in Linux for beginners or ideas you want to inform the Linux community, add a comment below.

Follow us on:

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn More

Share your love

Leave a Reply

Your email address will not be published.

Ads Blocker Image Powered by Code Help Pro

Looks like you are using an Adblocker.

We have detected that you are using extensions to block ads. Please support us by disabling these Adblocker.