DEV Community

Cover image for List of Linux commands for Server Administrators
Gbadamosi Tajudeen
Gbadamosi Tajudeen

Posted on

List of Linux commands for Server Administrators

Linux commands are powerful tools that give users access to the operating system and a range of functions. Each command is a piece of software created to carry out a particular activity, from basic file operations to intricate system management duties. The terminal, which offers a text-based user interface for interacting with the Linux system, is used to execute these instructions.

The flexibility and adaptability of Linux commands is one of its main advantages. To build sophisticated processes and automate operations, they may be combined and used in a variety of ways. A lot of commands also offer input and output redirection, which enables one command's output to be stored to files or supplied as input to another.

Linux commands may be used to handle a variety of things, including files and directories, processes, networking, users, system monitoring, packages, and more. Users have the capabilities to monitor and control their Linux systems efficiently because to the broad variety of commands that are accessible.

Being productive and efficient while dealing with Linux systems may be considerably improved by learning and mastering Linux commands. Users can explore the file system, edit files and directories, analyze system resources, troubleshoot difficulties, and automate repetitive processes by being familiar with the most frequently used commands and their associated parameters.

Overall, Linux commands are the foundation of the Linux operating system and enable users to fully use its capabilities and complete a variety of activities quickly and effectively.

1.
Sudo Su
In Linux, the sudo command enables a user to run a command with the rights of a different user, often the superuser or root. "Sudo" stands for "superuser do." Using the sudo prefix and your password causes a command to run with elevated privileges, giving you momentary administrative access. When you need to carry out actions that need root access, such as system setup, package management, or editing protected files, this might be helpful.

The su command in Linux is used to switch to another user account, typically the superuser or root. "su" stands for "switch user." When you run the "su" command, you are prompted to enter the password for the target user. By default, when you run "su" without specifying a username, it assumes you want to switch to the root user. However, you can also use "su" to switch to other user accounts if you have the necessary permissions.

Linux Command
sudo su has shown in the command line above, helps Switches to the root user. It opens a new shell as the root user, providing a root prompt without requiring a password. To exit from the root user shell, you can type exit.

2.
apt update
For updating the local package lists, Debian-based Linux systems like Ubuntu utilise the apt update command. Your system will always have the most up-to-date knowledge of the software packages that are accessible thanks to the synchronisation of package information from the preset repositories.

Linux Command

When you use the _apt update _ command, the package manager (often apt) makes contact with the package repositories listed in the /etc/apt/sources.list file and obtains details about the packages and their versions. It searches for new packages or updates that have become available since the last update.

3.
apt install wget
The apt install command is used in Debian-based Linux distributions, such as Ubuntu, to install software packages from the configured repositories. In this case, you want to install the wget package, which is a command-line tool for downloading files from the web.

Linux Command

4.
mkdir
The mkdir command is used in Linux to create directories (also known as folders). It allows you to create one or more directories (dir1 dir2 dir3 etc.) at a specified location within the file system.

Linux Command
Their is need for appropriate permissions to create directories in specific locations. If you encounter a permission denied error, consider running the mkdir command with root privileges using sudo if necessary.

5.
cd
The cd command in Linux is used to switch from the current working directory to previous in the terminal. It allows you to navigate the file system and switch to a different directory. To navigate into the previous directory you were in, you can use the command cd -

Linux Command
The fundamental tool to navigate the terminal's file system is the cd command. You can access files, navigate directories, and run commands from various locations.

6.
touch

The touch command in Linux is used to create empty files or update the timestamps (access time and modification time) of existing files. It is a versatile command that is often used to quickly create new files or update timestamps. To create a empty file use touch

Linux Command
If you want to create multiple files at once, you can provide a space-separated list of file names use touch "file1.txt", "file2.txt", and "file3.txt".

Linux Command
After running the touch command, the specified file(s) will be created. You can verify the creation or modification of the file(s) using other commands such as ls or stat.

7.
ls
The ls command is used in Linux to list the contents of a directory. It allows you to view the files and directories within the specified directory.

Linux Command

The ls command provides various options to modify its behavior. Here are a few commonly used options:

'-l' (long format): Displays detailed information about files, including permissions, ownership, size, and timestamps.
'-a' (all files): Shows all files, including hidden files that start with a dot (.).
'-h' (human-readable): Displays file sizes in a human-readable format, such as kilobytes or megabytes.
'-r' (reverse order): Lists files and directories in reverse order.

8.
sudo rm
The sudo rm command is used in Linux to delete files or directories with root privileges. "sudo" is used to execute the command as the superuser or root, and "rm" stands for "remove."

Linux Command

Note to use sudo_carefully, as it grants elevated privileges, including the ability to delete important system files. Verify your actions and ensure that you are deleting the intended files or directories.
To check if the action has been successfully executed, the Linux command _lS
is used.

Linux Command

9.
mv

To move a file from one directory to another directory

Follow the steps below;

  • Create the second directory with the same command mkdir

Linux Command

  • Supply both the file's name and the destination folder's name when using the "mv" command to move a file.
    Use the command mv /

  • To confirm if the file have been moved into the second created directory, navigate into the second directory using cd and Input the command "ls" to view the moved file.

10.
pwd
pwd Linux command stands for "Print Working Directory." It is a simple command that allows you to display the current working directory, which is the directory you are currently located in within the file system.
To use the pwd command, type the command in the terminal.

Linux Command
This output will vary depending on where you are in the file system. It helps you quickly identify your current location so you can navigate or work with files and directories effectively.

11.
cd ..
The cd command represents "Change Directory," why the .. stands for the parent directory. To change to the parent directory.

  • Open your terminal or command prompt.

  • Type the following command: cd .. and press the Enter key.

The parent directory of your current working directory will be reached with this command. For example, if your current directory is /home/username1/docs, running cd .. will take you to /home/username1/.

Other commands are listed as follow

ssh: Connect to a remote server using ssh.
cp: Copy files and directories.
mv: Move or rename files and directories.
head: Display the beginning of a file.
:wq: To exit the text space.
tail: Display the end of a file.
chmod: Change file permissions.
chown: Change file ownership.
chgrp: Change group ownership of a file.
tar: Archive files into a tarball.
gzip: Compress files.
gunzip: Decompress files.
ifconfig: Configure network interfaces.
netstat: Display network statistics.
wget: Download files from the web.
curl: Transfer data to or from a server.
top: Monitor system processes.
ps: Display information about running processes.
kill: Terminate a process.
man: Display the manual page for a command.
history: View command history.
useradd: Create a new user.
passwd: Change user password.
shutdown: Shut down the system.
reboot: Restart the system.
df: Display disk space usage.
du: Estimate file and directory space usage.
find: Search for files and directories.
locate: Find files by name.
scp: Securely copy files between hosts.
rsync: Synchronize files and directories.

Top comments (0)