THE basic commands under Linux are essential for anyone who wants to navigate this environment effectively. They allow you to manage files, manipulate directories and perform various system operations. For example, the command CD is used to change directories, while mv Allows you to move or rename files. Other commands like cat are used to display the contents of files, and man provides access to help to understand the use of different commands. Master these fundamental commands makes everyday use of Linux easier and improves the efficiency of administrative tasks.
The Linux operating system, recognized for its flexibility and power, is based on a multitude of orders that allow users to interact effectively with the system. For a user wishing to navigate easily in this environment, it is essential to master a set of basic commands. This article gives you an overview of the most important commands to know to optimize your use of Linux.
Navigating the file system
Getting started with the Linux environment often begins with navigating the file system. Two essential commands in this regard are CD And ls.
The cd command
The order CD, which stands for “change directory”, allows you to change the current directory. To use it, simply indicate the path of the directory you want to go to, whether it is relative Or absolute.
The ls command
To list files and directories in the current directory, the command ls is essential. It provides a quick overview of the file structure, and many options can be added to refine the results, such as ls -l for a detailed display.
Managing files and directories
Manipulating files and directories is another key skill in Linux. Orders cp, mv, And rm are most commonly used for this purpose.
The cp command
The order cp, for “copy”, allows you to copy files and directories. Its basic syntax is simple: cp source destination. By adding the option -r, you can also copy directories.
The mv command
mv is used to move files or rename files and directories. If you specify the same directory, it acts as a rename, otherwise it moves the file to the specified path.
The rm command
To delete files, the command rm is essential. Its use requires special attention, because once a file is deleted, it is difficult, if not impossible, to recover it. The option -r allows you to delete directories and their contents.
View and edit file contents
Managing files is not limited to moving or deleting them; it is also important to visualize their content. For this, the command cat is often used.
The cat command
cat, short for “concatenate”, allows you to display, combine and write the contents of files to standard output. It is very useful for quickly reading files without opening them in an editor.
Administration and user management
In a multi-user context, management of access rights and users is crucial. Orders sudo And passwd are among the most used.
The sudo command
The order sudo allows you to execute commands with the privileges of another user, generally that of the administrator (root). It is essential for performing tasks that require high permission levels.
The passwd command
To change a user password, passwd is the appropriate command. Just enter passwd followed by your username to make the change.
Process management
To monitor running processes and manage their states, commands p.s., top, And kill are particularly useful.
The ps command
The order p.s. displays the status of running processes. With different arguments, it can provide detailed information about each process.
The top command
For dynamic process management, top presents a real-time view of running tasks, their resource consumption, and allows you to kill processes directly.
The kill command
The order kill allows you to terminate a process using its ID. This is often necessary when certain tasks become unresponsive or consume too many resources.
Software installation
For all your apps and tools, knowing how to install software is essential. This is usually done through package managers like apt for Debian-based distributions, or yum for those based on Red Hat.
To learn how to install software easily on Linux, check out this guide: Install software on Linux.
Creating and running scripts
To automate certain tasks, it is useful to create scripts. The most common scripting language is bash. Digging a little deeper into the subject will allow you to master creating and running scripts.
To find out how to create a bash script easily, don’t hesitate to follow this tutorial: Create a bash script in Linux.