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” is a basic command that displays the current date and time.
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.
$ TZ=GMT date
The current date and time of the system can be manually set in Linux.
$ date –set=”20220104 20:29”
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.
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.
The “free” command displays the total amount of free and utilised memory in the system.
In one line, the command “uptime” gives you information about how long the system has been running.
The command “passwd” stands for password and is used to modify a user’s password.
$ passwd username
The command “exit” is used to exit the system and log out of the current user, as the name implies.
Shutting down the system is done with the “shutdown” command.
Use shutdown -c to cancel the command
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.
$ mkdir ubuntu
To remove files from a directory, use the “rm” command.
$ rm empty_file
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.
$ mv dir1 dir2 # mv to move files $ mv dir dir # mv to rename file
To copy data from a source file to a destination file, use the “cp” command.
$ cp file file_copy
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.
$ tail -f /var/log/syslog
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.
$ sudo apt update
The command “cd” stands for change directory and it is used to change the current directory user is operating in via Terminal.
$ cd /etc/
The command “pwd” in Terminal displays the path to the current directory in which the user is working.