linux

Linux is widely popular in the developer or sysadmin community. These are a few commands which are quite famous among developers and admins. Whenever in doubt, always try to use ‘–help’ command option of the command.

grep –

grep command is used when you want to search a string in a file or files. Even grep can search the strings in the binary files which may not be in human-readable form.

$grep <string_you_want_to_search> <file/path>

$grep -rniI <string_you_want_to_search> <path>

-r option is search recursively in to directory
-n option is to show the line number in the file where string matches.
-i option to ignore the letter case
-I option to ignore the binary files while seraching the string.
grep command example

find –

Find command is useful if you want to look for a file but are not sure where exactly it is residing in the filesystem or whether the file is present or not.

$find <Path> -name <filename>

$find / -name hello.txt

<Path> – you can provide the path where it will find all the files recursively
-name – option is to search the file with name of file
<filename> – Name of the file you want to search. If your not sure about extention then you can put * after the filename. eg: $find / -name hello*
find cmd example

top –

the top command is quite popular if you want to monitor the memory utilization for each process running on the system.

$top

ps –

the ps command shows the process list running on the system.

$ps -e

df –

df command is used to see the partition-related information of the disk.

$df

$df -h

-h is for human friendly values.

du –

the du command is to know the size of all the files or directories recursively.

$du 

$du -sh *

-s – to summarize
-h – to human readable format

Don't forget to use the --help option of the commands to understand the command better and use it smartly. 
Spread the love

Rohit

I am a software developer by profession. I love coding and learning new skills.

Leave a Reply

Your email address will not be published. Required fields are marked *