Ubuntu useful Commands
Ubuntu’s world greets you and is ready to provide you complete control over your system. However, as a novice, you may find the Command Line Interface (CLI) frightening. Many individuals perceive Linux to be more difficult to use as an operating system, especially if they are used to Windows or macOS.
Commands used for system information
date
“date” is a basic command that displays the current date and time.
TZ
The time zone provided in the path “/etc/localtime” is used by default by the “date” command. The Terminal command “TZ” can be used to alter the time zone for Linux users.
[sourcecode language="plain"]$ TZ=GMT date [/sourcecode]
The current date and time of the system can be manually set in Linux.
[sourcecode language="plain"]$ date –set=”20220104 20:29” [/sourcecode]
df
The programme “df” displays the amount of disc space utilised and available on each file system, as well as the name and path of each file system.
[sourcecode language="plain"]$ df [/sourcecode]
The command “df -h” produces the same results as “df,” but the data is now in a more human-readable format that a new user may understand.
[sourcecode language="plain"]$ df-h [/sourcecode]
free
The “free” command displays the total amount of free and utilised memory in the system.
[sourcecode language="plain"]$ free [/sourcecode]
Uptime
In one line, the command “uptime” gives you information about how long the system has been running.
[sourcecode language="plain"]$ uptime [/sourcecode]
Passwd
The command “passwd” stands for password and is used to modify a user’s password.
[sourcecode language="plain"]$ passwd username [/sourcecode]
Exit
The command “exit” is used to exit the system and log out of the current user, as the name implies.
[sourcecode language="plain"]$ exit [/sourcecode]
Shutdown
Shutting down the system is done with the “shutdown” command.
[sourcecode language="plain"]$ shutdown [/sourcecode]
Use shutdown -c to cancel the command
mkdir
Users can create directories and folders on the system using the command “mkdir.” To create a directory, the user using this command must have appropriate permissions over the parent directory; otherwise, an error will occur.
[sourcecode language="plain"]$ mkdir ubuntu [/sourcecode]
To remove files from a directory, use the “rm” command.
[sourcecode language="plain"]$ rm empty_file [/sourcecode]
MV
The command “mv” has two functions.
To relocate files or folders in the system from one location to another.
To change the name of a file or folder.
[sourcecode language="plain"]$ mv dir1 dir2             # mv to move files $ mv dir dir_rename    # mv to rename file [/sourcecode]
CP
To copy data from a source file to a destination file, use the “cp” command.
[sourcecode language="plain"]$ cp file file_copy [/sourcecode]
Tail
The “tail” command publishes the last N rows of data from the specified input or file. It prints the last 10 lines of the selected files by default.
[sourcecode language="plain"]$ tail -f /var/log/syslog [/sourcecode]
Sudo
The command “sudo -I” is used to keep the session running as a root user, which has far greater rights than a regular system user.
[sourcecode language="plain"]$ sudo apt update [/sourcecode]
Cd
The command “cd” stands for change directory and it is used to change the current directory user is operating in via Terminal.
[sourcecode language="plain"]$ cd /etc/ [/sourcecode]
pwd
The command “pwd” in Terminal displays the path to the current directory in which the user is working.
[sourcecode language="plain"]$ pwd [/sourcecode]
Reading your article helped me a lot and I agree with you. But I still have some doubts, can you clarify for me? I’ll keep an eye out for your answers.
Reading your article helped me a lot and I agree with you. But I still have some doubts, can you clarify for me? I’ll keep an eye out for your answers.
Nice post. I learn something totally new and challenging on websites