CS Electrical And Electronics
@cselectricalandelectronics
All PostsCommunicationsEmbedded SystemProgrammingTop Things

Top Linux Commands For Engineers, Useful Linux Commands Asked

Hello guys, welcome back to my blog. In this article, I will discuss the top Linux commands for engineers, these Linux commands are very useful and are most commonly asked during interviews.

If you have any doubts related to electrical, electronics, and computer science, then ask questions. You can also catch me @ Instagram – Chetan Shidling. 

Also, read:

Top Linux Commands For Engineers

In Linux, the shell (or terminal) is the lifeline of the coder or developer, and of any power user. Something that can be accomplished on the GUI (by clicking on various buttons), can be accomplished with much better efficiency on the terminal by utilizing commands. Maybe one can not recognize all the commands, but with everyday usage, one can readily recognize the most valuable ones. The following manual will teach you to the tiniest set of necessary commands needed to use your Linux computer efficiently.

File Commands

01.lsDirectory listing
ls command
02.ls -alA formatted listing with hidden files
la -al command in linux
03. ls -ltSorting the Formatted listing by time modification
ls -lt command in linux
04.cd qemuChange directory to qemu
cd command in linux
05. cdChange to the home directory
cd command in linux s
06.pwdShow current working directory
07.mkdir newfolderCreating a directory dir
08. cat >filePlaces the standard input into the file
cat>file command in linux
09.more wget-logOutput the contents of the file
more file command in linux
10.head file.cOutput the first 10 lines of the file
head file command in linux
11.tail file.cOutput the last 10 lines of the file
tail file command in linux
12.tail -f file.cOutput the contents of the file as it grows, starting with the last 10 lines
tail -f file command in linux
13.touch fileCreate or update file
14.rm fileDeleting the file
rm file command in linux
15.rm -r newfolderDeleting the directory
16.rm -f fileForce to remove the file
rm -f file command in Linux
17.rm -rf dirForce to remove the directory dir
rm -rf dir command in Linux
18. cp file1 file2Copy the contents of file1 to file2
cp file1 file2 command in Linux
19.cp -r dir1 dir2Copy dir1 to dir2; create dir2 if not present
c
20.mv file1 file2Rename or move file1 to file2, if file2 is an existing directory
mv file1 file2 command in Linux
21.ln -s file1 linkCreate symbolic link, link to file
ln -s file link command in Linux

Process management

01. psTo display the current working processes
ps command in Linux
02.topDisplay all running process
top command in Linux
03.kill pidKill the process with given pid
kill pid command in Linux
04. killall procKill all the process named proc
killall proc command in Linux
05.pkill patternWill kill all processes matching the pattern
06.bgThe list stopped or background jobs, resume a stopped job in the background
bg command in linux
07.fgBrings the most recent job to the foreground
fg command in Linux
08.fg nBrings job n to the foreground

Searching

01.grep pattern fileSearch for pattern in file. The grep filter searches a file for a spcific pattern of characters, and displays all lines that contain that pattern.
grep [options] pattern [files]
Options Description
-c : This prints only a count of the lines that match a pattern
-h : Display the matched lines, but do not display the filenames.
-i : Ignores, case for matching
-l : Displays list of a filenames only.
-n : Display the matched lines and their line numbers.
-v : This prints out all the lines that do not matches the pattern
-e exp : Specifies expression with this option. Can use multiple times.
-f file : Takes patterns from file, one per line.
-E : Treats pattern as an extended regular expression (ERE)
-w : Match whole word
-o : Print only the matched parts of a matching line,
 with each such part on a separate output line.

-A n : Prints searched line and nlines after the result.
-B n : Prints searched line and n line before the result.
-C n : Prints searched line and n lines after before the result.
grep -h file1 command in Linux
02.grep -r pattern dirSearch recursively for pattern in dir
grep -r pattern dir command in Linux
03. command | grep patternSearch pattern in the output of a command
04.locate fileFind all instances of file
locate file command in linux
05.find -name filenameSearches in the current directory (represented by a period) and below it, for files and directories with names starting with filename.
find -name filename command in Linux
06.pgrep patternSearches for all the named processes, that matches with the pattern and, by default, returns their ID
pgrep pattern command in Linux

System Info

01.dateShow the current date and time
date command in Linux
02.calShow this month’s calender
cal command in Linux
03. uptimeShow current uptime
uptime command in Linux
04.wDisplay who is on line
w command in Linux
05.whoamiWho you are logged in as
whoiam command in Linux
06.finger userDisplay information about user
07.uname -aShow kernel information
08.dfShow the disk usage
df command in linux
09.duShow directory space usage
du command in Linux
10.freeShow memory and swap usage
free command in Linux

Compression

01.tar cf file.tar fileCreate tar named file.tar containing file
tar cf file.tar file command in Linux
02.tar xf file.tarExtract the files from file.tar
03.tar czf file.tar.gz filesCreate a tar with Gzip compression
tar czf file.tar.gz files command in Linux
04.tar xzf file.tar.gzExtract a tar using Gzip
05.tar cjf file.tar.bz2Create tar with Bzip2 compression
06.tar xjf file.tar.bz2Extract a tar using Bzip2
07.gzip fileCompresses file and renames it to file.gz
gzip file command in Linux
08.gzip -d file.gzDecompresses file.gz back to file
gzip -d file.gz command in Linux

Network

01.ping hostPing host and output results
ping host command in Linux
02.whois domainGet whois information for domains
whois host command in Linux
03.dig domainGet DNS information for domain
dig host command in Linux
04.dig -x hostReverse lookup host
dig -x host command in Linux
05.wget fileDownload file
06.wget -c fileContinue a stopped download

Shortcuts

01.ctrl+cHalts the current command
02.ctrl+zStops the current command, resume with fg in the foreground or bg in the background
03.ctrl+dLogout the current session, similar to exit
04.ctrl+wErases one word in the current line
05.ctrl+uErases the whole line
06.ctrl+rType to bring up a recent command
07.!!Repeats the last command
08.exitLogout the current session

This was about ” Top Linux Commands For Engineers “. I hope this article ” Top Linux Commands For Engineers ” may help you all a lot. Thank you for reading.

Also, read:

Author Profile

CS Electrical And ElectronicsChetu
Interest's ~ Engineering | Entrepreneurship | Politics | History | Travelling | Content Writing | Technology | Cooking
Share Now

CS Electrical And Electronics

Interest's ~ Engineering | Entrepreneurship | Politics | History | Travelling | Content Writing | Technology | Cooking