10 Most Used Linux Commands: An Essential Beginner’s Guide

When you’re just starting out with Linux, knowing the most important shell commands is essential for navigating, managing files, and configuring your system quickly and effectively. In this guide, you’ll discover the 10 main Linux commands , valuable both for beginners and for those who want to optimize their daily terminal work.You will discover the essential Linux terminal commands that every user should know to move easily through system management.

Index

  • What is Linux?
  • Minimum requirements to use Linux
  • The most used Linux commands
    • 1. cd and chdir command in Linux
    • 2. ls Command in Linux
    • 3. cp command in Linux
    • 4. rm Command in Linux
    • 5. mv Command in Linux
    • 6. chmod command in Linux
    • 7. Nano, Pico, Ed and Red editors in Linux
    • 8. Clear command in Linux
    •  9. pwd Command in Linux
    • 10. The pine command in Linux
  • Other Linux commands for security and management
  • Conclusions
  • Frequently Asked Questions (FAQ)
    • What are the basic Linux commands to get started?
    • How can I get help with Linux commands?
    • Is it possible to undo an rm command on Linux?

What is Linux?

Linux is an open-source operating system based on the kernel developed by Linus Torvalds in 1991. Thanks to its free and open source nature, anyone can use, modify, and distribute the source code, contributing to its ongoing development. Unlike proprietary operating systems such as Windows or macOS , Linux is available in numerous distributions, also called distros , designed to meet different needs, from home use to enterprise servers.

Today, Linux is present practically everywhere: it powers most web servers, the world’s most powerful supercomputers, millions of Android smartphones, IoT devices, smart TVs, routers, and infrastructure used by companies like Google and Amazon. Among the most popular distributions are Ubuntu , Debian , Fedora , Linux Mint , and Rocky Linux .

Linux’s main strengths are stability , security , high performance , and extensive customization options . For this reason, it is chosen by both users who want a free operating system and system administrators who need to manage servers and critical infrastructure.

Minimum requirements to use Linux

One of the advantages of Linux is its ability to run even on older computers or those with limited hardware resources. Indeed, there are numerous distributions optimized for older PCs, inexpensive notebooks, and embedded devices. Generally speaking, to install and run most modern Linux distributions, you’ll need a 64-bit Intel or AMD processor , at least 1 GB of RAM , and around 10 GB of free disk space . Installation also requires a CD/DVD drive or, more commonly, a bootable USB stick . Naturally, more full-featured distributions like Ubuntu or Fedora may require more resources to provide a smoother user experience, while lightweight versions like Lubuntu or Puppy Linux can run even on very old hardware.

The most used Linux commands

Linux shell commands are indispensable tools for any operation on the operating system. Below is a selection of the 10 most used Linux commands, essential for everyday use.

1. cd and chdir command in Linux

The cd (Change Directory) command is used to change the current working directory in the Linux terminal and is one of the most used commands. It allows you to quickly move between folders and subfolders in the file system.

Some practical examples:

  • cd Documents > enter the Documents folder.
  • cd .. > go back to the parent folder.
  • cd / > accesses the root directory.
  • cd ~ > return to the user’s Home folder.
  • cd – > returns to the previously visited directory.

Behind the Linux cd command is the chdir() system function , used by programs to change a process’s current directory. The function receives the path to the folder to navigate to and returns 0 if the operation completes successfully or -1 if an error occurs, such as if the directory doesn’t exist, the path is incorrect, or the user doesn’t have the necessary permissions.

2. ls Command in Linux

The ls command in Linux is used to display files and folders in a directory. Without options, it displays the contents of the current folder in alphabetical order . However, it can be used with various parameters to obtain more details, view hidden files, or sort the results.

Practical examples:

  • ls → show files and folders in the current directory.
  • ls -l → display details such as permissions, owner, size and modification date.
  • ls -a → also shows hidden files, i.e. those starting with a dot.
  • ls -lh → show details in readable size, e.g. KB, MB or GB.
  • ls / → lists the contents of the parent directory.
  • ls -R → also recursively shows the contents of subfolders.

It is one of the most useful commands for navigating the Linux file system and quickly checking the contents, permissions, and structure of folders.

3. cp command in Linux

The cp (Copy) command is used to copy files and folders in Linux. The basic syntax is cp source destination : the first parameter specifies the file to be copied, the second the name or path of the copy. By default, if the destination file already exists, it is overwritten.

Practical examples:

  • cp document.txt copy.txt → creates a copy of the file with a new name.
  • cp document.txt /home/user/backup/ → copies the file to another folder.
  • cp -i document.txt copy.txt → asks for confirmation before overwriting an existing file.
  • cp -v document.txt copy.txt → shows the operations performed during copying.
  • cp -R backup folder/ → copies a folder and all its contents, including subfolders.
  • cp -u *.txt archive/ → copies only the most recent files or those not yet present in the destination.

It is one of the fundamental Linux commands for performing backups, duplicating files, and quickly transferring data between directories.

4. rm Command in Linux

The rm (Remove) command is used to delete files and, with the appropriate options, folders and subfolders. Unlike Windows, files deleted with rm aren’t moved to the Recycle Bin, but are removed directly from the file system, so it’s recommended to use it with caution.

Practical examples:

  • rm file.txt → delete the specified file.
  • rm -i file.txt → asks for confirmation before deleting.
  • rm -f file.txt → force deletion without confirmation prompts.
  • rm *.txt → deletes all files with the .txt extension in the current folder.
  • rm -r folder → delete a folder and all its contents.
  • rm -rf folder → forcefully delete a folder and all subfolders without confirmation.

Common options include -i for added security, -f to force deletion, and -r to recursively remove directories. Since this operation is generally irreversible, it’s a good idea to always verify the path and selected files before running the command.

5. mv Command in Linux

The mv (Move) command is used to move or rename files and directories in Linux. Unlike the cp command , it doesn’t create a copy but directly moves the file to the new location. If the destination doesn’t exist, the command is used to rename the file or folder.

  • mv file.txt newfile.txt → rename the file.
  • mv file.txt Documents/ → moves the file to the Documents folder.
  • mv backup folder/ → move a directory.
  • mv -i file.txt destination.txt → prompts for confirmation before overwriting.
  • mv -v file.txt Documents/ → show operation details.

The mv command is a fundamental tool for organizing files and folders and quickly managing renaming and moving them in the Linux file system.

6. chmod command in Linux

The chmod (Change Mode) command is used to change file and folder access permissions in Linux. This command allows you to determine who can read, write, or execute a file. Permissions are assigned to the owner (user), the group (group), and other users (others).

The most used numerical values ​​are:

  • 4 = reading (read)
  • 2 = writing (write)
  • 1 = execute

Practical examples:

  • chmod 755 script.sh → owner can read, write, and execute; others can read and execute.
  • chmod 644 document.txt → The owner can read and write; others can only read.
  • chmod 777 file.txt → everyone can read, write, and execute the file (not recommended for security reasons).
  • chmod u+x script.sh → adds execute permission to the owner.
  • chmod gw file.txt → removes write permission from the group.
  • chmod -R 755 folder → applies permissions recursively to a folder and all its contents.

The chmod command is essential to Linux security because it allows you to control who can access, modify, or execute files and directories on your system.

7. Nano, Pico, Ed and Red editors in Linux

Linux provides several terminal text editors, each designed for different needs. The most popular are nano , pico , ed , and red .

Nano is the most popular text editor in modern Linux distributions. It’s easy to use and displays the main keyboard shortcuts at the bottom of the screen. It allows you to create, edit, and save files without any special technical knowledge.

  • nano file.txt → opens or creates the file.txt file.
  • Ctrl + O → save the file.
  • Ctrl + X → exit the editor.
  • Ctrl + W → search for a word or phrase.

Pico is the predecessor of Nano. In modern Linux distributions, Nano is generally installed instead of Nano and is nearly identical in use. Many systems allow the nano and pico commands to be used interchangeably .

And it’s one of the oldest Unix text editors, introduced in the late 1960s. It works entirely through text commands and doesn’t have a modern visual interface. It’s particularly useful in minimal environments or for advanced administration tasks.

  • and file.txt → opens a file for editing.
  • a → adds new lines of text.
  • w → save the file.
  • q → closes the editor.

Red (Restricted Ed) is a limited version of Ed designed to increase security. It allows modification only to files in the current directory and prevents the execution of shell commands, reducing the risk of unwanted operations.

For most Linux users, nano is the simplest and most immediate choice, while ed and red are historic and specialized tools used mainly by system administrators and Unix experts.

8. Clear command in Linux

The clear command clears the Linux terminal screen, removing all visible text and displaying a clean prompt. It doesn’t delete files, folders, or command history; it simply declutters the terminal window when there’s a lot of information on the screen.

To use it, simply type:

clear

In many Linux distributions, you can achieve the same result by pressing the Ctrl + L key combination . This command is particularly useful during administration, programming, and troubleshooting tasks, when you want to restart from a screen clear of previous output.

 9. pwd Command in Linux

The pwd (Print Working Directory) command displays the full path of the current directory you’re currently in within the Linux terminal. It’s especially useful when you’re working in multiple directories and want to quickly find your current location in the file system.

Practical examples:

  • pwd → shows the path of the current directory.
  • pwd -P → displays the actual path to the directory, resolving any symbolic links (symlinks).

For example, the command might return:

/home/fabrizio/documents/projects

Among the most commonly used options are -L , which displays the logical path while preserving any symbolic links, and -P , which displays the actual physical path. The pwd command is a simple but indispensable tool for navigating the Linux file system and quickly checking the current working directory.

10. The pine command in Linux

The pine command launches a text-based client for reading, managing, and sending email and newsgroups from a Linux terminal. It’s designed to be easy to use, with on-screen menus, context-sensitive help, and basic functions like viewing, saving, deleting, printing, replying, and forwarding messages.

With pine you can also compose emails using the pico editor , use an address book, manage mail folders, receive notifications of new messages and attach files thanks to MIME support.

  • pine → start the program.
  • pine [email protected] → opens the message composition window for that recipient directly.
  • pine -attach file.pdf [email protected] → prepares an email with an attachment.
  • pine -f folder → opens a specific mail folder.

The pine command is especially useful on servers or systems without a graphical interface, where you need to manage mail directly from the terminal.

Other Linux commands for security and management

Managing permissions, searching for files or processes, and compressing data are common operations on Linux. In addition to chmod , which we’ve included among the basic commands, there are other basic Linux commands useful for security and management.

  • find : Search for files or directories based on various criteria.
  • grep : Search for text within files and display matching lines.
  • tar : Creates, unpacks, and manages compressed archives.
  • kill : Terminates a specific process by its process ID (PID).
  • sudo – Runs a command with administrative (root) privileges, allowing you to install software, change system configurations, and manage users.
  • chown : Changes the owner and group associated with files and directories, useful for managing permissions and security.

Conclusions

Knowing these Linux commands will help you get the most out of the terminal. A good knowledge of the shell makes working on any Linux distribution more efficient and secure.

Leave a Comment

Scroll to Top