DEV Community

Cover image for My top terminal commands
Rembrandt Reyes (He/Him)
Rembrandt Reyes (He/Him)

Posted on

My top terminal commands

I was recently watching a video that was walking beginners through terminal commands and they listed over 50 commands that you should use. 50!? Who uses more than 10 terminal commands?

The ones that I use (off the top of my head)

1) pwd

The command pwd stands for "print working directory" which gives your current location in terminal
pwd

2) cd directory

The command cd stands for "change directory" which allows you to navigate through the terminal.
cd

3) ls

The command ls will list all the computer files in your current directory.
ls

4) mkdir folder

The command mkdir will create a new folder in your current directory.
mkdir

5) clear

The command clear will... you guessed it, clear your terminal.

6) 🐈 aka cat file

The command cat will return the contents of a file.
cat
If you cat command a directory it will let you know that as well.
catDir

7) touch file

The command touch file will create a new file in your current directory.
touch

8) rm file

The command rm file will remove the file from your current directory
rm

There are some special options that you can pass into some of these commands but for now, the basics are all that is needed to be a hacker!

Some honorable mentions - these are commands that I use here and there.

  • mv - move files or rename files
  • sudo - "SuperUser Do", this enables admin/root permissions, only use this if you know what you are doing
  • grep - search for something in a file
  • ping - check your connectivity status to a server.
  • echo - used to move data into a file

Discussion (17)

Collapse
vlasales profile image
Vlastimil Pospichal • Edited on
  • vim - to edit anything
  • sed - to filter and update
  • awk - to manage table data
  • alias - to create own command acronyms
  • git - to version controll
  • find - to search files
  • make - to run tasks
  • xmllint, xsltproc, xqilla, xmlstarlet - to working with XML
  • jq - to working with JSON
  • php, python3, gcc, clisp, bc, octave ... compilers and interpreters
Collapse
rembrandtreyes profile image
Rembrandt Reyes (He/Him) Author

vim, alias, & git are ones I use often as well. Can't say the same for the other two (awk & sed)

Collapse
vlasales profile image
Vlastimil Pospichal

They are very useful for working with huge files.

Collapse
hamzajd profile image
Hamza Jadid

history | grep "search text"

Collapse
drhyde profile image
David Cantrell

In order from most- to least-used, the top 20 on one of my machines are ...

mutt, ps, ls, cd, ssh, vi, ping, find, host, grep, which, rm, cat, nslookup, man, history, whois, tree, touch, mount, ...

... and that's ignoring everything that's used from within any of my own scripts, and only counting the first command on a line, it ignores anything that might follow in a pipeline such as awk, sed, sort, uniq, tac, head, tail, cut, ...

... and that also ignores anything used in development (which I generally do on a different machine) such as git, cc, make, perl, python, go, ...

Collapse
rembrandtreyes profile image
Rembrandt Reyes (He/Him) Author

Yeah if I introduce development commands then git would be the number 1 command that I use.

Collapse
tanami profile image
Tanami

no love for find? it's so powerful!

Collapse
rembrandtreyes profile image
Rembrandt Reyes (He/Him) Author

I have honestly rarely/never used it 😂

Collapse
wicked7000 profile image
Wicked

Ive been making a lot of use out of these commands lately: (I'll admit they might not be a frequent use type of command but helpful to know)

ps -elf 
top

The first to check if prcoesses im expecting to run are running. Sometimes combined with a grep to search for a specific part of a command. And then top to see what kinda usage those processes are producing.

Collapse
rembrandtreyes profile image
Rembrandt Reyes (He/Him) Author

👏 Don't use these often, but they do come in handy.

Collapse
____marcell profile image
Marcell Cruz

Great article, my favorite

grep -ril 'search_string' ./folder

Collapse
rembrandtreyes profile image
Rembrandt Reyes (He/Him) Author

One of my favorite commands lsof -nP -i4TCP | grep LISTEN to see what open connections I have.

Collapse
pengeszikra profile image
Peter Vivo

history 0 | grep "..."

Collapse
realabbas profile image
Ali Abbas

cd, clear, touch, ls, rm they are the most used

Collapse
fairen profile image
Fairen

Greate summary !
You could also use fasd to replace cd and use tail -f <some_file> when the file is too long for cat.

Collapse
rembrandtreyes profile image
Rembrandt Reyes (He/Him) Author

Interesting command, thanks for the share!

Collapse
akramnarejo profile image
Akram Narejo

it's very few bro but again it's good that u have shared.