Linux Commands for Beginners
To learn open source operating systems, it is very necessary to know at least the basic Linux commands. Here's all what you need.

Directory Function
- ls: Will display the names of all files and sub-directories in the current or the working directory. There are various add-ons, which when post-fixed to the ls command, have different actions.
-a lists the hidden files. -d shows the name of the current directory. -F shows directories with a trailing '/' in name. -g shows group ownership of file in the form of a long list. -i prints the node number of each file. -l gives a long list giving details about files and directories. -R lists all sub-directories encountered. -t sorts by modified time instead of name. - cd: This command is used to change directories. If we use cd.. we move to the parent directory. The absolute path appears if cd /home is done. The system is returned to the user's home directory when only cd is used.
- mkdir: Makes new directory of the name specified after the command. The path given should be relative i.e. as a sub-directory to the current directory. Example: mkdir my_dir will make a new directory with name 'my_dir'.
- rmdir: Removes the directory stated after the command. The deletion occurs only if the directory is empty. If it is not empty you need to use rm -r command followed by the directory name. Example: rmdir my_dir deletes the empty my_dir directory. While rm -r my_dir will delete a directory even if it has some content.
- more <filename>: This command will run or display the file specified by the filename.
- cp <file1> <file2>: Copies file1 to file2, keeping the original file1 as it is. For this, both the files must be in the same working directory. In case there's change in directory, the path of the other directory must be specified.
- mv <file1> <file2>: Moves file1 to file2 and removes file1 from its original location.
- rm: This command will remove the given file from the system. There are various wildcards available, which, if we use can give us selective removal options. Example: rm file removes the file with name 'file'. rm h*c will remove the files beginning with 'h' and ending with 'c'. rm* deletes all files from the current directory. rm -i* deletes all files by confirming before deleting every file.
- rm -r/: This horrifying command will delete all the directories in your system if you're an admin user and then you should be sent to a madhouse for such an act.
- find /user -<name> <flnm>: Searches and finds file named 'flnm' in the sub-directories of the directory named 'user'.
chmod - change file access permissions.
Usage: chmod -<rights> <permissions> <filename/directory>
- The value of <rights> decides the access rights on the file which should be in the current directory.
- <permissions> specifies the kind of rights being granted.
- <filenames> specifies file or directory that is asking permissions for rights. In case of a directory, you must post-fix '-R' to chmod.
| u | - User who owns the file |
| g | - Group that owns the file |
| o | - Other |
| a | - All |
| r | - Read the file |
| w | - Write or edit the file |
| x | - Execute or run file as a program |
Numeric Permissions: CHMOD can also to attributed by using Numeric Permissions:
| 400 | - Read by owner |
| 040 | - Read by group |
| 004 | - Read by anybody |
| 200 | - Write by owner |
| 020 | - Write by group |
| 002 | - R/W by anybody |
| 100 | - execute by owner |
| 010 | - execute by group |
| 001 | - execute by anybody |
These are the basic and essential Linux commands that beginners can bring into use. There are tons of other commands, but it is always advisable to first get a hand on with these basic ones because without mastering these, a beginner cannot progress to the higher level Linux commands.
Like This Article?
Follow:

Post Comment | View Comments


