15 Linux Commands you must know

 Before Jumping into the Linux Commands you first make sure you have a Terminal in the OS. and you can use it in the Windows also in PowerShell, Git Bash or Command Line Prompt. And in Linux you can use Terminal So I have PowerShell, cmd, git bash in my Operating System so I will use that to Show you

And This is the first basic command at least one should know atleast these all 15 commands then you can able to create file , edit , and do operations with it.

1. pwd Command

pwd prints the current working directory. It helps you identify the directory you are currently in, which is useful when navigating the file system. It shows the path of current working directory




2. history Command

The history command displays a list of previously executed commands, along with line numbers. By default, it shows the last 1,000 commands. It shows all executed previous commands







3.touch Command

touch command creates a new file in the current working directory. the file which is created by touch command is initially empty file later on by vi command you can edit file which I will explain you in next command.





4. vi Command

vi command helps to edit the file or you can directly create the file and edit it on that directly without using touch command. simply you can write "vi text.txt" then text.txt you can write it on via using i to insert character inside the file text.txt then you can save it "Esc + : + wq" command you can save the file via using this command.










Step to use vi command :

if you write "vi text.txt" then this window pops up











then type or press " i " then you can edit the above panel and you can write your text as you want to write.

to Save or close the window tab you have to write or press "Esc + : + wq" to save & close the window.

5. cat Command

Cat command is used to display content of the file and just print it down.



 

6. head command

head command is also used to  display content , but it has the facility to show top 5 lines top n lines of content available in the file.

If we want to only see top n lines in the file then you can do the following this or use the "head -3 text.txt" 





7. tail command

tail command is used to list last n lines in the file 

tail -3 text.txt (It can be used like this)



8. ifconfig (For Linux) / ipconfig/all (For Windows)

ifconfig is used to mainly display the mac address of the computer it also been writen as HWaddress,Physical address,etc and it also displays more thinks like IPv6 address ,etc ,etc 








9. ping Command

ping command is when executed it sends packets to the destination or hostname and shows output of the result as RTT(Round trip Time), Packet Loss , Statistics as a no of packets sent received , loss.it is used for network troubleshooting and monitoring.

it is used as " ping devcp.in "





10. netstat command

it is also used to solve network related isuues, it dispalys network connection, routing table,interface statistics , masquerade connection , tcp ,udp,unix connections,and more.
it is also used for seeing the ports of all ip addresses. and it shows all the network or ips address running in the sysytem/hardware/host machine.

it shows protocol,local address,foreign address,state of the system.

there are commands to use netstat

a. netstat -a : it will show everytime like protocols like tcp,usp,unix,etc.

b. netstat -at : will only show tcp protocols

c. netstat -au : will only show udp protocols














11. ls -l / ls -ltr Command

Ls command lists the files,directories present in the current working directories.

ls -l command and ls -ltr command are the same command which shows the total no of files in the current working directory and with the time , date , file Node Number that when it was created in the one format.








12. who , whoami command

who command shows the how many users are working on the system and when it was created,etc
whoami shows only one person name who is currently working on the system.




13. mv Command

mv command is called for move or rename the file name 

it is used as " mv oldfilename newfilename "

it will move all its data from old to newfile and it will delete the oldfile automatically. thats why it is called move or rename the filename.







14. man command

man command shows all the information of the linux commands just write man and in front of that write any command name which you need info of it.

it can be written as " man ping " 








15 command > filename

" > " it is used to store the output of the command which will be coming after executing command it will get stored in filename 

as like it can be written as " ls > file.txt "

rm command is used to delete the file



Previous Post Next Post