Linux commands - Part II - How?
The last articles dealt with how you would get to a terminal to execute Linux commands and why we have the need to execute these commands. Summing up, a terminal from an Ubuntu instance doesn't provide a GUI. Hence, we require Linux commands to interact with the system via terminal.
System Administration commands
File commands
Fun fact: Unix and Linux are not synonymous. Linux is the clone of Unix. It has several features similar to Unix but they still have some key differences. This article should give a fair idea of the differences. Do check out if interested.
(Note: I'm only including the commands I'm aware of and USED in tasks. If you are a beginner, there's no better way to understand the working other than doing them along. You only get better understanding while using them for your tasks, otherwise they are not only boring but also difficult to grasp.)
Now we deal with "The" commands. We'll divide the commands according to their functionality for better understanding.
Directory commands
As the name suggests, these commands help to navigate the file system. They are as follows:
- pwd : stands for "print working directory". It displays the current working location or directory of the user. It displays the whole working path starting with /.
- Syntax: pwd
- ls : used to show the list of files or folders in any directory.
- Syntax: ls
- ls -l or ll ( ll is an alias of ls -l) : used to show the list in a long list format.
- Syntax: ls -l or ll
- ls -a : will enlist the whole list of the current directory including the hidden files.
- Syntax: ls -a
- cd : stands for "change directory". It is used to change from the present directory to the directory you want to work in.
- Syntax: cd <directory name>
- cd .. : used to move to the parent directory of current directory, or the directory one level up from the current directory. “..” represents parent directory.
- Syntax: cd ..
- mkdir : used to create a new directory.
- Syntax: mkdir <directory name>
- rmdir : used to remove a directory from your system.
- Syntax : rmdir <directory name>
System administration is managing system performance, security, handling servers and configuration operations of the computer. Few commands that enable these functions are listed below:
- users : shows usernames of who are currently logged in.
- Syntax: users
- sudo : stands for “Super User DO!”. It runs a command as a superuser, mostly, root user.
- Syntax: sudo <-additional options>
- whoami: stands for "who am i". It displays the username of the current user.
- Syntax: whoami
- su : switchs from one user to another user.
- Syntax: sudo su - switch to root user
- nano : is a command line editor used to create, edit and open a file.
- Syntax: nano <filename>
- vi : is similar to nano. It is also used to create, edit and open a file.
- Syntax: vi <filename>
- vim : is similar to vi. It is also used to create, edit and open a file.
- Syntax: vim <filename>
Linux considers everything as as file. Even a directory is just a file containing names of other files. We can deal with different files to manage them efficiently using the below commands:
- touch : used to create a file.
- Syntax: touch <filename>
- cp : used to copy a file or directory.
- Syntax: cp <existing filename> <new filename>
- mv : used to rename or to move a file or directory from location to another.
- Syntax: mv <source filename> < destination filename>
- rm : used to remove a file or a directory.
- Syntax: rm <filename>
- rm -rf : deletes directory forcefully. It means a file or directory will be deleted anyhow even if it has read-only permission.
- Syntax: rm -rf <filename>
File Content commands
To help look up the content in the files, these few commands are used:
- cat : used to display the content of a file, copy content from one file to another, concatenate the contents of multiple files, display the line number, display $ at the end of the line, etc.
- Syntax: cat <filename>
- more : used to display output one screenful at a time, in cases of larger files.
- Syntax: more <filename>
The content above is only to provide a very minute idea of the working of these commands. A very few, yet often used commands have been sited above. Many commands come with various options which provide a functionality which you can access in detail here. This YouTube video gives a good idea on various important topics and covers basics of Linux as well clearly.
Thus, we come to the end. Do ping your suggestions.
Linux do be making you feel like this |
Until next time! Tata!
Comments
Post a Comment