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. 

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:
  1. 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
  2. ls : used to show the list of files or folders in any directory.
    • Syntax: ls
  3. 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
  4. ls -a : will enlist the whole list of the current directory including the hidden files.
    • Syntax: ls -a
  5. 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>
  6. 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 .. 
  7. mkdir : used to create a new directory.
    • Syntax: mkdir <directory name>
  8. rmdir : used to remove a directory from your system. 
    • Syntax : rmdir <directory name> 

System Administration commands
System administration is managing system performance, security, handling servers and configuration operations of the computer. Few commands that enable these functions are listed below: 
  1. users : shows usernames of who are currently logged in.
    • Syntax: users
  2. sudo : stands for “Super User DO!”. It runs a command as a superuser, mostly, root user.
    • Syntax: sudo <-additional options>
  3. whoami: stands for "who am i". It displays the username of the current user.
    • Syntax: whoami
  4. su : switchs from one user to another user.
    • Syntax: sudo su - switch to root user
  5. nano : is a command line editor used to create, edit and open a file.
    • Syntax: nano <filename>
  6. vi : is similar to nano. It is also used to create, edit and open a file.
    • Syntax: vi <filename>
  7. vim : is similar to vi. It is also used to create, edit and open a file.
    • Syntax: vim <filename>



File commands
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: 
  1. touch : used to create a file. 
    • Syntax: touch <filename>
  2. cp : used to copy a file or directory.
    • Syntax: cp <existing filename> <new filename>
  3. mv : used to rename or to move a file or directory from location to another.
    • Syntax: mv <source filename> < destination filename>
  4. rm : used to remove a file or a directory.
    • Syntax: rm <filename>
  5. 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:
  1. 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>
  2. 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

Popular posts from this blog

Version Control Systems (VCS)

Creating AWS EC2 instance