DEV Community

Cover image for 🐧Terminal commands that I use every time.
Abhay Prajapati
Abhay Prajapati

Posted on

🐧Terminal commands that I use every time.

Your macOS, Windows, Linux the most basic commands are gonna be the same,
when every I start with new projects I have to move in to right ▶️ folder and then I use it.

1.

cd
Enter fullscreen mode Exit fullscreen mode

as simple C*hange *D*irectory, 📂when every you have to move in another folder the *cd come very handy, it can take you under and folder or outside a folder
ImInImHereGIF.gif

cd inside-dir
Enter fullscreen mode Exit fullscreen mode

if you want to go back

cd ..
Enter fullscreen mode Exit fullscreen mode

simple hack🧑🏿‍💻:-

// if you know the name of the previous directory uses them with cd.
cd ../back/moreback/anothemoreback
// now I am at anothermoreback
Enter fullscreen mode Exit fullscreen mode

same work with cd inside directory

cd inside/moreinside-inside/anotherinside-inside
Enter fullscreen mode Exit fullscreen mode

StephenColbertCantFindItGIF.gif

ls
//  list files or directories
Enter fullscreen mode Exit fullscreen mode

all📁 the directories in that current directory with be printed out.
from files folder but without hidden folders

ls -a
// want to see hidden folders & files use this.
Enter fullscreen mode Exit fullscreen mode

3.

PrinterGIF (2).gif
Now you know about changing directories and seeing the list of folders and files in a directory but how will you see which directory are you in.

// check print working directory
pwd
Enter fullscreen mode Exit fullscreen mode

very handy if you got stuck.

4.

CodingKiraGIF.gif

code .
code ./foldername
atom .
atom /foldername
Enter fullscreen mode Exit fullscreen mode

If you use the text-editors as I do then this terminal command will make your life ease.
writing the name of text-editor (mostly)you can access them, without any GUI


.
// is used to do any stuff in the current directory
and 
./foldername
// is used to do inside the given filename
Enter fullscreen mode Exit fullscreen mode

CodeReviewGIF.gif

node /filename
Enter fullscreen mode Exit fullscreen mode

I love writing javascript it's simple and easy, for writing pseudocode, if you have node installed you can use node filename to run inside the terminal without using the browser.
very handy for js guys

CatMatchGIF.gif

which ls
Enter fullscreen mode Exit fullscreen mode

if you want where your specific command is stored in computer, SSD,
type which command and name of the command
which can be any command ls cd nano PWD any command
and you will get the destination of the file.

thank you for joining me.

if you know come better command let me know👋🏿
Connect on
Twitter :- @Abhayprajapati_
GitHub :- TheabhayPrajapati

Discussion (2)

Collapse
michalzareba0001 profile image
Michal

I will add:

filename - to create a file
rm filename - to delete a file
mk dir name - to create folder
rm dir name - to remove folder

And i live Typescript so:
tsc filename.ts - to compile 😁

Collapse
theabhayprajapati profile image
Abhay Prajapati Author

osm man, i didn't mentioned these