DEV Community

Cover image for Reference Guide: Common Commands for Terminal
kymiddleton
kymiddleton

Posted on • Updated on

Terminal Commands Reference Guide: Common Commands for Terminal

Have you ever walked out of a room and then couldn't remember what you started to do? Have you ever convinced yourself a trip to the grocery store can be accomplished without a list only to arrive home without the one single item that was most needed? It happens to me, more than I'd like to admit, and I'm fairly certain I'm not alone. Throughout my career, I've developed a strategy to set myself up for success when moments of brain overload strike.

There are certain job responsibilities or steps of a process that are difficult to remember when performed on an infrequent basis or when learning them for the first time. This is where a quick reference list or guide can be a lifesaver. As a newbie to web development there are numerous steps to remember and until they've been committed to memory reference materials are my go-to. In case someone else is in need too I wanted to share the steps I've created for a few common processes needed as a new web developer.

Terminal:
The Terminal program is built-in on Mac computers and uses text commands to operate the computer without using the user interface. Terminal commands for GitHub will all begin with the prefix git followed by the command.

Terminal

Common Commands:

  • ~ Indicates the home directory
  • pwd Print working directory (pwd) displays the path name of the current directory
  • cd Change Directory
  • mkdir Make a new directory / file folder
  • touch Make a new file
  • .. Go up one level / directory
  • cd ~ Return to home directory
  • clear Clears information on the display screen to provide a blank slate
  • ls List provides a list of all files with a directory
  • ls -l Displays a long list vertically with file permissions, date modified and file name
  • ls -la Displays all files

Auto Complete File Names:
Enter the first couple of lines of the file name followed by the tab key and it will auto complete the rest of the file path name.

Next up: Part 2 Create a GitHub Repository

For the completed Reference Guide Series:

Discussion (8)

Collapse
gypsydave5 profile image
David Wickes

Small typo - cd~ will do nothing, cd ~ will return to the home directory. But you might prefer to just type cd on its own, which will also return to the home directory.

For a pc, I think it's called the Windows Command Prompt.

I'd really leave out Windows from your tutorial - it uses different commands to the ones you're using here. But they will still (mostly) apply to Linux users.

Finally, you've got to add ls -la - showing all files can be very useful!

Collapse
asparallel profile image
AsParallel

Windows reply is only true for cmd.

Even if you find the powershell aliases disasteful and incomplete, the Linux subsystem for Windows has native bash, and can run zsh, fish etc. I'd rather put in a caveat you'd need to add that or use cygwin rather than be exclusionary. It encourages them to experiment with better things.

Collapse
kymiddleton profile image
kymiddleton Author

Thanks for the feedback! I'll make some updates. :)

Collapse
vguarnaccia profile image
Vincent Guarnaccia

Two keyboard shortcuts I find very helpful are Ctrl+l, which clears the screen, and Ctrl+r which searches through the command history for recently used commands.

Collapse
kymiddleton profile image
kymiddleton Author

I love learning new tips! Thanks for sharing.

Collapse
asparallel profile image
AsParallel

Other common and important commands for working with the file system: mv, cp, rm, ln, chown, chmod and in general, man.

Collapse
kymiddleton profile image
kymiddleton Author

I'm not familiar with these but I'll look them up and add them to my list. Thanks so much for sharing!!

Collapse
shopalino1 profile image
shopalino

Nice one