DEV Community

Cover image for Basics Terminal Command Every Web Developer Should Know.
Gaurav Singh
Gaurav Singh

Posted on

Basics Terminal Command Every Web Developer Should Know.

  • Home Directory ~

Image description

  • See all files in the current Directory ls

Image description

  • See in which Directory you are currently now pwd

Image description

  • Clear Console clear

Image description

Navigation Commands

  • Change Directory cd

Image description

  • Traverse back to Directory cd ..

Image description

Root Vs Home Directory

  • Root Directory /

Image description

  • Home Directory ~

Image description

Absolute vs Relative Path

  • Absolute

Image description

  • Relative Path

Image description

Create a new Directory

  • mkdir dir

Image description

Flags

Flags are the additional command embedded with the commands to show more in the directory (Hidden folders/files)

  • ls -l

Image description

  • ls -a

Image description

Create a New file

  • touch filename

Image description

Delete Files/Folders

  • Delete files rm - filename

Image description

Delete Folders

  • Empty Folder

Image description

  • Folder with files

Image description

I am a Web Developer & enjoy working on challenging projects, which is what makes this job so rewarding. You can reach out to my My Portfolio Site. I hope this article will helpful

Top comments (11)

Collapse
 
jonrandy profile image
Jon Randy 🎖️

The touch command isn't actually for creating new files. It's for updating the access and modification times of the specified file or files. The fact that it creates the file if it doesn't exist is merely a convenient side effect.

Collapse
 
gaurav_webdev93 profile image
Gaurav Singh

Yes. You're right that the touch command didn't intend to create the new files, If files already exist then we can access & modification the file otherwise it'll create a new file

Collapse
 
thestillfracture profile image
Chris Howard

It's not a command, per se, but the up/down arrow functionality is something everyone should know. Toggles through previously entered commands. This is very handy if you're doing the same tasks several times over (avoids extra typing) and is helpful in reviewing what you've done in the event that it didn't work as intended.

Collapse
 
commdao profile image
commdao

Bro, you just changed my life

Collapse
 
baduit profile image
Lena

And then you become addicted to it like me and press 11 times the up arrow to find back a ls :D

Collapse
 
kwnaidoo profile image
Kevin Naidoo • Edited

This is a good start, I would also recommend the following:

  • git
  • scp somefile sshuser@ip-address:/home/sshuser/
  • ssh sshuser@ip-address
  • grep
  • sed
  • tail
  • awk
  • htop
  • netstat -tupln --- sometimes you need to see what's holding up a port.
  • ps aux | grep python --- useful to find processes
  • kill -9 "process name" --- pair with above to kill a process that's misbehaving
  • nohup --- keep your script running even if there's a network disconnect
  • nice --- resource balancing for your scripts.
Collapse
 
gfallasc profile image
Gabriel • Edited

Agreed with @kwnaidoo, also it is good to understand the concepts of Redirections when using UNIX commands, that would be a good follow-up post of more advanced topics as well as using pipes like ps aux | grep python.

Collapse
 
lotfijb profile image
Lotfi Jebali

This article is helpful but in my opinion it could've been much helpful if you mentioned Git commands

Collapse
 
gaurav_webdev93 profile image
Gaurav Singh

I'll post another article related to Git commands

Collapse
 
sreno77 profile image
Scott Reno

This is a good introduction

Collapse
 
ant_f_dev profile image
Anthony Fung

In addition to Mac, these will also work in Linux. A subset also works with Windows command line interfaces too (Cmd/PowerShell).