Basic Linux Commands – Ubuntu, Centos, and Debian
☰ In this chapter, you will learn
- Basic Linux - Ubuntu/Debian and Centos commands
If you are embarking on the journey of learning Linux server management, having a solid understanding of Linux commands is essential. If you're already familiar with Linux commands and have recent experience working on the Linux console, feel free to skip this chapter.
This section introduces some fundamental yet crucial Linux commands that will prove invaluable as you manage your VPS server.
Simply open the Ubuntu/CentOS terminal and begin entering the commands. Learning and executing Linux commands is straightforward and will enhance your server management skills.
1. Essential Console Commands
| # | Command | Description | 
|---|---|---|
| 1 | clear | This command is used for clearing the console screen. | 
| 2 | --help | This command shows list of all available options along with their usage information for that
                    specific command. 
 | 
| 3 | !! | It is a shortcut for executing the last commands. | 
| 4 | Ctrl + c | It is used for terminating the current execution. | 
2. Directory/File Handling
| # | Command | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | ls | lscommand is used for listing the file and directories in a directory.
 
 | ||||||||||||
| 2 | cd | This command is used for changing the current working directory. 
  | ||||||||||||
| 3 | pwd | pwd(Print Working Directory) command returns the name of current working directory.
 | ||||||||||||
| 4 | mkdir | mkdir(Make Directory) command is used for creating a directory.
 | ||||||||||||
| 5 | rmdir | rmdir(Remove Directory) command is used for removing specified directory.
 | ||||||||||||
| 6 | touch | touchcommand is used for creating a new empty file.
 | ||||||||||||
| 7 | rm | rm(Remove) command is used for removing a file.
 | ||||||||||||
| 8 | mv | mv(Move) command is used for moving or renaming a file or a directory.→ Renaming a Directory: Syntax: mv [old directory name/filename] [new directory name/filename]→ Moving a Directory: Syntax: mv [current directory] [source directory] | ||||||||||||
| 9 | echo | echocommand in Linux is used for writing something into a file, displaying text, and
            displaying the variable value on the terminal.Saving text into a file. Displaying variable value. | ||||||||||||
| 10 | printf | printfcommand is also used for storing text on a file, displaying text, and displaying the
        variable value on the terminal. | ||||||||||||
| 11 | cat | catcommand is used for showing the content of a file. | 
3. System Information Command
| # | Command | Description | 
|---|---|---|
| 1 | uname | unamecommand is used for displaying system information. Use this command with -a option to display all the information. | 
| 2 | whoami | This command displays the name of current logged in user.  | 
| 3 | df | dfcommand is used for displaying disk usage information in Linux. | 
| 4 | du | ducommands display the sizes of directories and subdirectories. | 
| 5 | free | This command shows the system memory information.  | 
| 6 | uptime | The uptimecommand provides information about the current time, the duration the system has been running, the number of users currently logged in, and the system load averages over the last 1, 5, and 15 minutes. | 
| 7 | lscpu | This command shows detailed cpu information.  | 
| 8 | lspci | This command shows PCI information along with connected device.  | 
| 9 | lsusb | This command shows information about USB buses and the device connected to them.  | 
4. Network Commands
| # | Command | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | ip | ipcommand is used for configuring and displaying network interfaces and routing information.
 | ||||||||
| 2 | ping | pingcommand is used to test the reachability of a host on an internet. | ||||||||
| 3 | netstat | The netstatcommand in Linux is used to display various network-related information such as network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. | ||||||||
| 4 | ssh | It is used to establish a secure shell (SSH) connection to a remote server or device. a. To connect a remote server using default port b. Connect to a Remote Server on a Specific Port:  | ||||||||
| 5 | scp | The scpcommand is used to securely copy files between host over a network.a. Copy a File from Local to Remote: b. Copy a File from Remote to Local: c. Copy a Directory Recursively:  | ||||||||
| 6 | wget | This command is used for downloading files from the internet. a. Download a File b. Save with a Different Name: c. Recursive Download (Download Entire Website):  | ||||||||
| 7 | curl | The curlcommand is widely used for making HTTP requests from the command line and is a powerful tool for various tasks, including testing APIs, downloading files, and interacting with web services.Download a File:  |