21. cut commandThe
cut command selects specific sections from a file and prints them as a Terminal output. The syntax looks like this:
cut options file
Unlike other Linux utilities, the cut command’s options are mandatory for file sectioning. Here are some of the flags:
•
-f – selects a specific row field.
•
-b – cuts the line by a specified byte size.
•
-c – sections the line using a specified character.
•
-d – separates lines based on delimiters.
You can combine multiple options for a more specific output. For example, this command extracts the
third to
fifth field from a comma-separated list:
cut -d',' -f3-5 list.txt
22. diff commandThe
diff command compares two files and prints their differences. Here’s the syntax
diff file_name1 file_name2
By default, the
diff command only shows the differences between the two files. To print all the content and highlight the discrepancies, enable the context format using the
-c option. You can also ignore case sensitivity by adding
-i.
For example, run the following to show only the differences between
1.txt and
2.txt:
diff -c 1.txt 2.txt
23. tee commandThe
tee command outputs another command’s results to both the Terminal and a file. It’s helpful if you want to use the data for further processing or backups. Here’s the syntax:
command | tee [options] file_name
If the specified file doesn’t exist,
tee will create it. Be careful when using this command since it will overwrite the existing content. To preserve and append existing data, add the
-a option.
For example, we will save the ping command’s output as new entries in the
test_network.txt file
ping 8.8.8.8 | tee -a test_network.txt
24. locate commandThe
locate command searches for a file and prints its location path. Here’s the syntax:
locate [options] [keyword]
If you use the
-r option to search files using regular expressions, omit the
[keyword] argument. The
locate command is case-sensitive by default, but you can turn off this behavior using the
-i flag.
Note that
locate will look for files from its database. While this behavior speeds up the search process, you must wait for the list to refresh before finding newly created items.
Alternatively, enter the following to reload the data manually:
updatedb
25. find commandThe
find command searches for a file within a specific directory. Here’s the syntax
find [path] [options] expression
If you don’t specify the path, the
find command will search your current working directory. To find files using their name, add the
-name option followed by the keyword.
You can specify the type of item you are looking for using the
-type flag. The
–type f option will search files only, while
-type d will find directories. For example, we will check
file.txt in
path/to/folder:find path/to/folder -type f -name "file"
Unlike locate, the
find command searches through folders in real time. While it slows down the process, you can look for new items immediately without waiting for the system database to refresh.
26. sudo commandsuperuser do or
sudo enables non-root users who are part of the
sudo group to execute administrative commands. Simply add it at the beginning of another utility like so:
sudo [options] your_command
For example, enter the following to open a file using
nano as an administrator:
sudo nano file.txt
The Terminal will prompt you to enter the user’s password before executing the command. By default, you must reenter it after five minutes of inactivity.
Typically, you don’t add any option to sudo, but you can check them by entering:
sudo --help
27. su and whoami commandsThe
su command lets you switch to another user in the Terminal session. The syntax looks as follows:
su [options] [username]
If you don’t specify any option or username, this command will switch you to the
root user. In this case, you must enter the password before changing the account.
You can check the currently logged-in user from the Linux command-line shell. Alternatively, use the
whoami command:
whoami
28. chmod commandChmod lets you
change the permissions of files or directories. The basic syntax looks as follows:
chmod [options] [permission] [file_or_directory]
In Linux, there are three folder and file permissions – read (
r), write (
w), and execute (
x). You can assign them to three parties – the
owner, a
group, or
other accounts belonging to neither category. Consider this example:
chmod -rwx---r-– file1.txt
The spot after the first hyphen (
–) specifies the permission for the owner of
file1.txt. In the previous example, we grant them the
rwx privilege.
The next spot is for groups. Since we won’t grant them any privilege, we put three hyphens to indicate emptiness. The last slot is for other users who only have
read or
r permission.
29. chown commandThe
chown command lets you change the ownership of files, directories, or symbolic links. Here’s the syntax:
chown [options] newowner:newgroup file1 file2
If you want to assign a user as the new owner of an item, leave the group name empty. For example, we will make
admin-vps the owner of
file1.txt:
chown admin-vps file1.txt
Conversely, omit the username to make all group members the owner. Remember to write the colons (

like so:
chown :newgroup file1.txt
30. useradd, passwd, and userdel commandUse the useradd command to create a new account in your Linux system. The syntax is as follows:
useradd [options] new_username
By default, the
useradd command doesn’t prompt you to give the new user a password. You can add or change it manually later with the
passwd command:
passwd new_username
To remove a user, use the
userdel command followed by the account name like the syntax in the example:
userdel new_username
Since managing other users requires a
superuser privilege, run these commands as
root or with the
sudo prefix.
31. df commandThe
df command
checks your Linux system’s disk usage, displaying the used space in percentage and
kilobyte (KB). The syntax looks like this:
df [options] [file system]
Note that the
df command operates at the
file system level. If you don’t specify one, the utility will display all the active file systems.
32. du commandTo check the size of a directory and its content, use the
du command. Here’s the syntax:
du [directory]
The command will check your working directory if you don’t specify a path or folder. By default, it breaks down each subfolder’s disk usage, but you can add the -s option to summarize the total usage in one output.
You can also use the
-M option to change the information from
KB to
MB.
33. top commandThe
top command displays all running processes in your system and their hardware consumption. The syntax looks like this:
top [options]
The
top command has various options. For example,
-p lets you check a specific process by specifying its ID. Meanwhile, add the
-d flag to change the delay between screen updates.
34. htop commandLike
top, the
htop command lets you display and
manage processes in your Linux server. It also shares the same syntax:
htop [options]
htop has options similar to
top, but you can add additional ones. For example,
-C enables the monochrome mode, while
–-tree shows processes in a hierarchical view.
35. ps commandThe
ps command summarizes the status of all running processes in your Linux system at a specific time. Unlike
top and
htop, it doesn’t update the information automatically. Here’s the syntax:
ps [options]
You can print a more detailed report by adding other options. For example, use
-A to list all processes in your system,
-r to check only the running ones, or
-u username to query those associated with a particular account.
36. uname commandThe
unix name or
uname command displays detailed information about your Linux machine, including hardware, name, and
operating system kernel. Its basic syntax looks as follows:
uname [options]
Without any option, the command will print your system’s kernel name. To check all information about your machine, add the -a option.
37. hostname commandUse the
hostname command to check your VPS hostname and other related information. Here is the syntax:
hostname [options]
If you leave the option empty, the command will print your hostname. Add -i to check your server’s IP address,
-a to print the hostname alias, and
-A to output the system’s fully qualified domain name (FQDN).
38. time commandThe
time command measures the execution time of commands or scripts to gain insights into your system performance. The basic syntax looks as follows:
time command_or_script
You can measure a series of commands by separating them using double ampersands (
&&) or semicolons (
;) like so:
time command; command; command
39. systemctl commandThe
systemctl command is used to manage services in your Linux system. Here’s the basic syntax:
systemctl subcommand [service_name][options]
The subcommands represent your task, like listing, restarting, terminating, or enabling the services. For example, we will
list Linux services using this:
sudo systemctl list-unit-files --type service --all
Note that this command might not work with older distributions since they use another service manager.
40. watch commandThe
watch command lets you continuously run a utility at a specific interval to monitor changes in the output. Here’s the basic syntax:
watch [options] command_name
By default,
watch will run your command every
two seconds, but you can change the interval using the
-n option followed by the delay. If you want to highlight changes in the output, add the
-d flag
source