Linux
Linux
Linux
This command refers to the present working directory in which you are operating; in
simpler words, in which your terminal is open. To check PWD, execute the pwd
keyword in your terminal and hit enter; the command of PWD is written below along
with the result of that command.
$ pwd
Command 2: dir
The dir command is used to print (on the terminal) all the available directories in
the present working directory:
$ dir
Command 3: ls
This command is used to list down all the directories and files inside the present
working directory (or you can give the path of a specific directory); the ls
command can be executed as shown below:
$ ls
$ ls -al
$ ls
$ ls -R
Command 4: cd
One of the most used commands of Ubuntu; you can change the directories in the
terminal using the “cd” command. For instance, the following command will change
the pwd to desktop.
$ cd
$ cd Desktop
$ cd /
Command 5: touch
This command can be used to create a new file as well one can use it to change the
timestamp of any file; the command given below will create a new text time in pwd:
$ touch file1.txt
Command 6: cat
This command is used to show the content of any file: For instance, the following
command will display the content inside “file1.txt”:
$ cat file1.txt
$ cat file1.txt file2.txt > output.txt
Command 7: mkdir
The above-mentioned command will make a directory in your pwd; for example, the
following command will make the directory “new” in pwd.
$ mkdir filename
$ mkdir filename /address
Command 8: rm
This remove command is used to remove the specific file from a directory; For
instance, below mentioned command would remove the “test.txt” file from the pwd:
$ rm test.txt
$ rmdir test
$ rm -r (for directorys)
Command 9: cp
The cp command will help you to copy any file or folder to any directory;
$ cp file1.txt /address
$ cp new -r directory1
Command 10: mv
You can use this command to move files around the computer, and you can also rename
files or directories inside a specific directory: the command given below will move
the “file2.txt” to “directory1”:
$ head file1.txt
$ tail file1.txt
$ wget https://download.virtualbox.org/virtualbox/6.1.26/VirtualBox-6.1.26-145957-
Win.exe
$ history
$ !2
$ man cat
amo
Command 19: ps
Using the -ps command, you will be able to get the list of processes.
$ ps
Command 20: zip or unzip
To convert your files to zip archive; you can get help by using the “gzip” command;
moreover, a zipped file can be unzipped using the “gunzip” command:
$ zip file1.txt
$ unzip file1.txt
$ hostname
$ ping youtube.com
Command 23: w
This command will display the user details that are currently logged into the
system:
$ w
$ passwd adnan
Conclusion
Command-line interface (CLI) is the basic utility of any machine; you can use it to
perform multiple tasks and can perform all those operations that can be performed
using GUI. It is not just a simple app; it is key to every operating system as
there are terminal commands behind GUI operations. All in all, CLI can be used to
operate the entire operating system without GUI. Like other OS, Ubuntu also
contains a terminal that supports hundreds of commands to perform different
operations. This article lists down the most used Ubuntu commands and their usage.
Every command can perform a specific task and can help you to automate the
requested action.
cd ~ (navigate to /home/user)
cd / (navigate to /root)
cd .. (go back one dir)
$ ps ax (system monitor)
$ ps ax | greb abbname (search)