Learn the Linux Command line: Navigation, File commands

Working with the Linux command line is one of the most important skills for any beginner. It allows you to control the system, manage files, and perform tasks faster than using a mouse. In this article, you will learn how to use the Linux terminal, understand the Bash shell, and run useful commands to navigate and manage files. You will also learn how to save time using command history and tab completion.

If you have not yet installed Linux, please go through the earlier article: How to Install Linux Mint and Set Up a Beginner-Friendly Linux Environment. That guide will help you get started with a Linux system, where you can follow along with this tutorial.


What Is the Linux Terminal?

The Linux terminal is a text-based tool that lets you type commands to control your computer. It does not use icons or windows. Instead, you give instructions by typing words.

You can open the terminal in Linux Mint by going to the menu and typing Terminal, or by pressing Control + Alt + T.

When you open it, you will see something like this:

Terminal On Linux Mint
Terminal On Linux Mint

This is called the command prompt. It tells you that the terminal is ready for your command.


What Is the Bash Shell?

Bash is the default shell in most Linux systems, including Linux Mint. The shell is the program that reads your commands and runs them.

Bash stands for Bourne Again SHell. It is a type of command interpreter that understands your instructions and talks to the Linux system.

Every time you type something and press Enter, Bash reads the command and tells Linux what to do.

You are now ready to learn some basic and useful commands.


Shell Navigation Commands

Navigation means moving around the file system. These are some important commands to know:

1. pwd – Show current directory

This command tells you where you are.

pwd
Output Of Pwd Command On Linux Mint
Output Of Pwd Command On Linux Mint

2. ls – List files and folders

This command shows the files in the current folder.

ls

If you want more details, then use the -i flag:

ls -i
Output Of Ls Command On Mint
Output Of Ls Command On Mint

3. cd – Change directory

This command lets you move into another folder.

cd Documents

To go back to the previous folder.

cd ..

To go to your home folder:

cd
Change Directory Using Cd Command
Change Directory Using Cd Command

If you do not know what a “directory” is, it is the same as a “folder” in Windows or macOS

File Management Commands

These commands help you work with files and folders. You can create, copy, rename, or delete things from the terminal.

1. touch – Create a new empty file

This creates a file named file1.txt:

touch file1.txt

2. mkdir – Make a new directory (folder)

mkdir myfolder

This creates a folder named myfolder

File And Folders Were Created
File And Folders Were Created

3. cp – Copy files or folders

To copy a file use the cp command like this:

cp file1.txt copy.txt

To copy a folder:

cp -r myfolder folder
Copying Files
Copying Files

4. mv – Move or rename files

To rename using the mv command:

mv oldname.txt newname.txt

And to move a file:

mv file.txt Documents/
Renaming And Moving Files Using The Mv Command
Renaming And Moving Files Using The Mv Command

5. rm – Remove (delete) files or folders

To delete a file:

rm file1.txt

To delete a folder and its contents:

rm -r myfolder
Deleting On Linux Mint
Deleting On Linux Mint

Important: There is no “Undo” button in the terminal. Be careful when using the rm command.

Command History

The terminal remembers your previous commands. This is very useful if you want to repeat or fix something.

How to view and use command history:

  • Press the Up Arrow to see the last command
  • Keep pressing Up to see earlier commands
  • Press Down Arrow to go forward again

You can also type:

history
Viewing History On Linux
Viewing History On Linux

This will list many of your recent commands. You will see numbers next to each one.

To run a command from history, use:

!number

For example:

!35

This will run the command number 35 from your history list.


Tab Completion

Tab completion helps you type faster. It fills in file or folder names so you do not need to type the full name.

How to use tab completion:

Start typing a command or file name, then press the Tab key.

Example:

If you have a file named longfilename.txt, type:

cat long

Then press Tab. The terminal will auto-complete it to:

cat longfile.txt

If more than one file matches, pressing Tab twice will show you all the options.

Tab completion works for: File names, Folder names, commands and, Paths. This can save a lot of time.


Practice The Commands

If you want to practice, open your terminal and follow these steps:

  • Make a new folder:
mkdir practice
  • Go into that folder:
cd prac tice
  • Create a new file:
touch notes.txt
  • Make a copy:
cp notes.txt copy.txt
  • Rename the file:
mv copy.txt info.txt
  • List the files:
ls -l
  • Delete one file:
rm info.txt

This short practice will help you get comfortable with real Linux commands.


What next?

In this article, you have learned the basics of using the Linux terminal and the Bash shell. You now understand how to open the terminal and run commands using the Bash shell. You have also learned how to move between folders using navigation commands such as cd and pwd. In addition, you practiced managing files by creating, copying, moving, and deleting them with simple commands like touch, cp, mv, and rm. You also discovered how to use command history to repeat previous instructions and how tab completion can help you type faster by automatically finishing commands and file names. These skills form the foundation for using Linux efficiently and will help you complete tasks more quickly and accurately as you continue learning.