It’ll not be surprising if a large number of windows or mac users are reading this article. After all, Ubuntu is seldom the first choice of laptop users and so it is sold less as a pre-installed OS. But if you’re reading this you’ve made the right choice and you’ll get 30 important Unbuntu commands to help you.
The reason why Ubuntu is less preferred and the reason why you’re reading this article is the same. In comparison to Windows or Mac OS, Ubuntu is not so user friendly. Ubuntu primarily uses the Command User interface(CUI) to allow users to access the operating system and run programs in it. While window uses Graphics user interface(GUI) as primary means to access.
In simple terms, you can use windows mostly using your mouse by clicking on icons and tiles to run programs. Whereas in Ubuntu you have to type Ubuntu command to run programs and use features of the Operating system. Therefore people find it easier to locate and run programs by clicking their icons.
What Ubuntu has for Day-to-day users
Ubuntu is named after African Philosopher Ubuntu which means “Humanity”. The name is apropos as this Debian Linux distributed operating system is free to download and use. It is developed by Canonical and was first released in 2004 since then it became popular among developers. It releases new versions every six months and long-term support every two years.
Ubuntu adheres to the word’s meaning and is totally free to use. Unlike windows where you only get the operating system with basic software and for the rest, you have to pay. Ubuntu comes preloaded with an open-source Libre office, firefox, and small games.
It can be used through Ubuntu commands, a set of alphabets and symbols, to run programs in it. The commands are not exactly simple but with usage, these can be learned and you can access your OS faster. You can even use Ubuntu without installing, yes you read right without even installing! Ubuntu can be loaded in a portable device like a pen drive and can be accessed in Desktop by plugging the pen-drive.
Basic Ubuntu Commands for Beginner
Ubuntu commands are used for accessing the computer and telling it what to do. Ubuntu commands are a little tedious yet better in terms of speed in comparison to GUI. Commands allow direct access to a program without wastage of time in navigating. You type Ubuntu commands in the Command-line interface, also referred to as the terminal. There are graphic user interfaces also available in Ubuntu but aren’t as efficient as Ubuntu commands.
If you are new to Ubuntu or even you have used Ubuntu for some time. Ubuntu commands are something that you require from time-to-time. Even the pro user doesn’t always type commands but copy and paste from a Pdf for another source. So for your ease of access here are 30 Ubuntu commands to help you quickly run programs in your OS.
1. pwd
This Ubuntu command falls under File and directory commands. Tilde(~) symbol is used with these commands. Tilde stands for the home directory. pwd stands for “print working directory” and is used to know your current directory. When you type pwd the path of the working directory is displayed from the root.
The command does not show symlinks but can be displayed using the -P option. This is a shell builtin command and so runs faster than external commands. You can use this Ubuntu command in the shell as $PWD.
2. ls
This command stands for ’’list’’ and is used to know the files in your current directory. Using ls with tilde will show files in your home directory. This Ubuntu command also shows files with their sizes, date of creation, and permissions. To get descriptive information about the listed file app -l with the command.
You can see even hidden files using this command. You can get a list of directories in reverse order by adding -r at with ls. Adding -ltr will also show file modification dates of files at last in the list.
3. cd
This Ubuntu command is one of the most important as it allows you to change directories. On opening the command-line interface enter the home directory by default. You can navigate to the root directory by using a slash(/) with cd and to the home directory using tilde(~).
You can move to the next directory within the current directory by typing “cd..”, and back to the previous directory using “cd-”. You can jump through multiple directories at once by typing the full directory path to the desired directory.
4. cp
The command is used for making a copy of the file. Using this Ubuntu command requires two file names to make exact copies with different names. If the second file doesn’t exist, the command will make a new folder and copy files in it. But in case the other file exists, it can lead to overwriting and loss of data.
You can also copy directories using this command. To copy a directory recursively you have to add -R after the command. This addition will copy the directories to the destination directory including all files of the copied directory. The copied directory becomes the subdirectory of the destination directory if it already exists.
5. mv
This Ubuntu command is used to move files to different locations or to rename the file. You rename type mv “file name” “new name” to rename it to words written in “new name”. While saving you have to specify the new name and when opened in the root shell it refers to the root directory, not the home directory.
To move a file you just have to type command with file name and directory. You can type “mv (file name) directory/destination”
6. rm
This is a basic command used to remove a file from a directory. What remove actually means is to unlink the file from the directory. It removes files, directories, symbolic links, etc. It is generally used to remove objects with multiple references.
Though used for removing it deletes the file and does not allow recovery. To be on the safe side you can add -i with the command to allow interactive deletion. This addition asks for confirmation before deleting the file and you can confirm by pressing Y. You can also do forced deletion by adding -f after the Ubuntu command.
7. mkdir
This is yet again a basic command and used to make directories. In comparison to windows, this means making a folder in which files are stored. You can make multiple directories with just this command at once and can also set permissions for them.
If you wish to create directories with parent directories, you can add -p after the command. The command will create a parent directory if it doesn’t exist. By adding / after each to create multiple directories. Adding -m after the command will give permissions to edit the directory.
8. rmdir
This Ubuntu command is used to remove directories just like files. The command is useful for deleting extra unwanted directories. Commonly, people create multiple directories by mistake so to remove them you can use this command.
This command allows deleting only empty directories and it is better to do so. Once removed the directories can not be restored so better allow only empty directories as you can create more.
9. free
This another Ubuntu command is used for the basic purpose of knowing the free and used memory in the system. It displays the storage in blocks by default. Typing -h will show you the memory usage in the shortest three nunits.
It also displays physical and swap memory along with buffers and caches used by the kernel. By adding -b, -k, -g, -m you can check memory in bytes, kilobytes, gigabytes, and megabytes respectively. Typing -t after free will show the total storage below the columns.
10. top
This is a basic as well as important Ubuntu command and is used for the same purpose as task manager in windows. Typing top in the terminal will display the total number of tasks running on the device. Along with tasks it also displays running processes with system resources, CPU, RAM, and Swap usage.
Every task is displayed with a PID or the process ID of the task. This PID can be used to kill tasks that are taking too much memory and are unwanted. To kill a task type k with the PID of the desired task.
11. Man
This Ubuntu command stands for manual and is used for finding manual files for every command even for the man command. You find a manual file for any command just type man “command” will find the specified command.
It is very useful for new users. By typing “man intro” you can get an introduction to the terminal and Ubuntu commands. “Man man” command will give you all info about man command so by this time you should’ve already typed it. You can navigate through files with up and down arrow keys and quit by typing “q”.
12. cat
This command is used to list the content of a file on standard output. Standard output means it can further be process by other programs and can be sent to devices. This Ubuntu command can also be used for creating and joining two files.
To use cat command just type filename with its extension. If the file does not exist it’ll create a new file. Writing three filenames together will join the first two files and store it in a new third file.
13. du
This Ubuntu command is very basic in comparison to Windows but equally important for Ubuntu. The command is used to display the disk usage for a dīrectory. It can be used to display both the space used by sub-directories and the total storage used by directories.
The command displays the disk usage in block by default. You can change it into gigabytes or megabytes by adding a -h after the du command. Adding a -sh can make it more descriptive, as -s stands for summary.
14. locate
Used for locating files as the name suggests, this Ubuntu command is commonly used. You can search for files using the exact name or use case sensitive listing in case you don’t remember the name. By adding -i after locate command you can get a list of files with names starting from that alphabet.
If the file has a name with more than two words you can add an asterisk between the words. Adding an asterisk will show all the files with names matching the two words.
15. find
Quite the same as the one mentioned before. Using this Ubuntu command you can search more than just files.
You can search the folder, name, creation date, modification date, and owner. You can also find a file within a directory. To search a file in a directory type find/directory/-name “filename”.
The command searches for the file in directory and subdirectories. It is different from locate as you can save time if you know the directory. You can search empty files for deletion and even search and delete with confirmation simultaneously using this command.
16. tar
This command is frequently used to search compressed files. Like Windows zip format Linux has tarball which allows compression as an option. It is used for archiving multiple files into tarball and uses large functions. To create an uncompressed tar archive file type “tar cvf “filename”.tar”.
To extract files from archive type “tar xvf “filename”.tar”. You can also compress tar files by using grip compression. To compresses a tar file just type “tar xvzf file.tar.gz. To untar a file type “xvfj “filename”.tar -(path of file directory)
17. chmod
This Ubuntu command is an abbreviated food change mode. This command changes the access mode of a file. You can change permissions of the file and make it readable, editable, executable, or all three for different users.
The command can be typed as chmod (reference for owner)(operator)(mode) file. Reference is the alphabet used for class like owner, group, others and all. Operator is used to add or remove the mode. Three basic modes are r, w, and x for permission to read, write, and execute respectively.
18. bg
This Ubuntu command is a process control command. It allows processes to run in the background and resume suspended processes. You can run a job in background by typing an & symbol at last of the command. You can select the job by typing % and the PID number or symbols.
The stopped job switched to background will resume and keep running in background without receiving any input from the terminal. You can also use name of numbers to select command by typing %” number” or %” command name”
19. fg
This Ubuntu command is used to do the opposite of what bg does. It is used to move a background job to foreground in the current shell. You can bring back a specific job by using its PID or it will automatically bring back the most recently suspended job.
If you just type “fg” it will bring the most recent job to foreground. While typing fg [ %job ID ] will bring a specific job to the foreground. The tasks brought back will be resumed automatically if suspended.
20. job
Another basic Ubuntu command lists the jobs running both in the foreground and background. If no list is displayed that means no jobs are running in the background. This command cannot be run in all shells. Only csh, bash, tcsh, and ksh shells can run this command.
By adding -l you can get PID of all the jobs running. Adding -r will list only running jobs while adding -s with display only stopped jobs.
21. Kill
This Ubuntu command is a built-in command and works the same as task manager in windows. You can end processes manually using this command. There are 62 signals you can use to terminate a process. To kill a process you require a PID.
If you have the PID type “kill PID” to kill the desired process. You can get the PID by using the ps command. PID -1 is the parent process of all the processes on the system.
22. ping
Ping stands for packet internet Groper mad the ping command is used to check network connectivity. This Ubuntu Command sends data packets with a message ping to an IP address or URL. It gets a response in recorded time called latency and low latency means faster connection.
You can even control the number of packets sent to the server by adding a -c after the ping command. To stop pinging, the processes of sending and receiving pings, you have to use ctrl+c, or else it’ll continue.
23. wget
This Ubuntu command is one of the most important ones. It is a non-interactive network downloader and is used for downloading files directly from the internet using links. This command downloads files from the server in the background and does not require user presence, unlike a browser.
It is a better alternative to web browsers as it’ll keep retrying a download if it fails. It also allows resuming the download if the server supports it.
24. uname
It is a short form for Unix name and is used to display system information like device name, operating system, kernel, etc. Like my pc properties in windows, this command helps in knowing your current Linux system.
To get all details in the following order as a kernel, network node hostname, kernel release date and version, machine hardware name, platform, and OS add -a after the command. You can get all the details one by one by typing extra commands like add -p for processor details.
25. echo
This Ubuntu command is to add data in a file. In technical language, it is used to display lines of text passed as arguments. This is a built-in command and is used in shell scripts and batch files. It has many options to be used with basic commands.
Using \n after a line creates a new line from where it is used. Adding \r will add horizontal spaces between texts while \v will add vertical space. There are many other options to allow more editing.
26. history
This Ubuntu command is particularly useful for you since you’re reading this article. Many users don’t type commands but copy theM. With the history command, you can review previously used commands and take a quick look to use them again.
The command is only available in Bash and korn shell. You can recall earlier executed commands, change, and execute them. You can be on the save side by using :p after history, a command to print before executing. Users can view the most recent commands using !! which is very useful.
27. hostname
This Ubuntu command is used to know the name of the host and network. The hostname is the name given to a computer attached to a network. The command helps to pinpoint a computer using the hostname. To use the hostname command type hostname “option” “file”.
The option allows a further specific search. Adding -A after hostname will provide Fully qualified domain names of the host system. While adding -d will give local domain names if available, if not, a blank response will be received.
28. useradd, userdel
Linux allows multiple users to use and operate on the same system. To effectively manage multiple users you can create new users on the system using useradd command.
You can not only create new users but also add passwords for that user account which better the multi-user experience. To add a password first add a new user by typing username “name” and then type passwd “alphanumeric password”. You can also delete a user by typing userdel “username”.
29. Zip, unzip
In windows, you’d usually require software to unzip files or had to use a command prompt. In Ubuntu using commands, you can compress and uncompress files. To create a zip file type zip myfile.zip “filename”.txt.
Using Unzip you can list, test, or extract files from a zip archive.
You can remove a file from the zip archive by adding -d after the zip command. You can also update a zip file by adding -u, you can update the list of files or add new files.
30. Head, tail
This Ubuntu command is used to see the first lines of text files. You can see up to 10 files from the start. You can also change this while typing the command to see limited files. To use this command type head -n“number of lines” “filename”.txt.
Whereas the tail command allows you to read the last 10 lines of the text file. To use tail command type tail -n” number of lines” “filename”.txt
Conclusion
These commands improve your experience with Ubuntu and being fluent with Ubuntu is a commendable feat. Especially when you have no experience with a CUI operating system like Ubuntu. You can easily input and try these commands.
Commands like man will further help you with understanding the terminal. It may seem like a bad choice when switching to Ubuntu from Windows or Mac OS. But once you get the hang of it, you’ll know that you made the right choice. A choice both economical and helpful if you are a tech-savvy developer. Now that you know the basics, go try them and take the first step towards accepting Ubuntu!
FAQs
1. How do I learn Ubuntu commands?
You can learn basic Ubuntu commands for different articles available online like this one. Ubuntu commands are easy and can be learned by continuous use and practice. You can also take courses available online, can watch youtube videos, and join discussion websites like Reddit. You can make it fun by interacting and learning from people around the world on these sites for free.
2. What can you do with the Ubuntu terminal?
The Command-line interface of Linux and is commonly referred to as the Terminal. You can operate your system using a terminal by writing specific commands. This article contains 30 such commands. These commands are used to do basic tasks like creating, moving, renaming folders, and files. You also see running programs and check System status etc.
3. How to end the process in Ubuntu?
To end a process or kill a command you require the Process ID of a command which you can get by typing “ps”. After you get the list with the PID of the process you want to kill. Just type kill” PID of the process” and the process will end.