Here is the list of some basic but very useful Linux commands that, as a developer, you should know.
1. man:
Man is very basic command of Linux that can help you get the usage and description of all Linux commands out there. Like, if you want to know about “ls” command and its options, you can simply execute, “man ls” in terminal and you will get the usage and description of “ls”.
Syntax: man (command name)
2. touch, cat and less:
Touch is used to create basic type of files in Linux systems. These files have “0” size. You might need to create files in server, you can use touch command to do so.
Syntax: touch (filename)
You can view the content of the file by using cat command. You can even edit the content using cat. You can type cat followed by file name to get the catalog view of the file content.
Syntax: cat (filename)
Less command gives short view of file content. less is similar to cat but it gives quick view of file. You can use keyboard navigation keys to scroll. You can also use ‘more’ command to get expanded view of file.
Syntax: less (filename) more (filename)
3. sort and grep:
Sort is used to sort the content in file. You can create a file and copy the content on file to test the sort command. You can use various flags to sort the content according to flags. You can use “-h” flag to sort according to numbers, “-k” and “-h” to sort in different columns, if the content contains months, you can use “-M” flag.
Syntax: sort (flag) (filename)
Grep is often used by system admins. You can use it to search specific string patterns in file and standard output. Grep works in file based operations. The output that you get by using Grep command includes sub-strings. You can search for individual word using grep, you can slo add flags like “-i” to grep some command.
Syntax: grep “(search sting)” (filename)
4. cut:
Cut is used to extract a portion of file using columns and delimiters. You can list everything in a column by using cut. You can even select multiple columns in cut. If you want to extract specific string from a file, you can use flags like, “-d” for delimiter and “-f” for field along with cut.
Syntax: cut (flag) (column) (filename)
5. sed:
sed is used for editing operation in non-interactive way. Sed gets you input from standard input or file to perform editing operation on file. This powerful utility can be very helpful in manipulating files. You can search and replace text in a file using sed along with flag. “s” is used to substitute the text from file. “-c” is used to replace text using sed.
Syntax: sed ’(flag)/(old-word)/(new-word)/‘ (filename)
6. tar:
You can use tar to create and extract archived files. You need to use “-cf” to create archived file and “-xf” to extract content from archived files. You can also use “-C” flag to archive the files to destination folder.
Syntax: tar (options) (archive-name) (file/folder-name)
7. find:
Find is used to find the files. You can simply find the files by using find command followed by file name. You can also use “/-name” flag to find folder using this tag.
Syntax: find -name find -name (filename)
8. diff:
You can use diff to find the difference between two files. Diff command can be used to analyse the files and prints of lines which are different. The command analyses the difference between the content of two files and shows the output.
1. man:
Man is very basic command of Linux that can help you get the usage and description of all Linux commands out there. Like, if you want to know about “ls” command and its options, you can simply execute, “man ls” in terminal and you will get the usage and description of “ls”.
Syntax: man (command name)
2. touch, cat and less:
Touch is used to create basic type of files in Linux systems. These files have “0” size. You might need to create files in server, you can use touch command to do so.
Syntax: touch (filename)
You can view the content of the file by using cat command. You can even edit the content using cat. You can type cat followed by file name to get the catalog view of the file content.
Syntax: cat (filename)
Less command gives short view of file content. less is similar to cat but it gives quick view of file. You can use keyboard navigation keys to scroll. You can also use ‘more’ command to get expanded view of file.
Syntax: less (filename) more (filename)
3. sort and grep:
Sort is used to sort the content in file. You can create a file and copy the content on file to test the sort command. You can use various flags to sort the content according to flags. You can use “-h” flag to sort according to numbers, “-k” and “-h” to sort in different columns, if the content contains months, you can use “-M” flag.
Syntax: sort (flag) (filename)
Grep is often used by system admins. You can use it to search specific string patterns in file and standard output. Grep works in file based operations. The output that you get by using Grep command includes sub-strings. You can search for individual word using grep, you can slo add flags like “-i” to grep some command.
Syntax: grep “(search sting)” (filename)
4. cut:
Cut is used to extract a portion of file using columns and delimiters. You can list everything in a column by using cut. You can even select multiple columns in cut. If you want to extract specific string from a file, you can use flags like, “-d” for delimiter and “-f” for field along with cut.
Syntax: cut (flag) (column) (filename)
5. sed:
sed is used for editing operation in non-interactive way. Sed gets you input from standard input or file to perform editing operation on file. This powerful utility can be very helpful in manipulating files. You can search and replace text in a file using sed along with flag. “s” is used to substitute the text from file. “-c” is used to replace text using sed.
Syntax: sed ’(flag)/(old-word)/(new-word)/‘ (filename)
6. tar:
You can use tar to create and extract archived files. You need to use “-cf” to create archived file and “-xf” to extract content from archived files. You can also use “-C” flag to archive the files to destination folder.
Syntax: tar (options) (archive-name) (file/folder-name)
7. find:
Find is used to find the files. You can simply find the files by using find command followed by file name. You can also use “/-name” flag to find folder using this tag.
Syntax: find -name find -name (filename)
8. diff:
You can use diff to find the difference between two files. Diff command can be used to analyse the files and prints of lines which are different. The command analyses the difference between the content of two files and shows the output.
ConversionConversion EmoticonEmoticon