Basic terminal commands and tips for beginner developers daily use

Published: · Reading time: 4 min

Knowing how to use a terminal is a good skill to have as a developer. You can use to run various tools or running git commands.

It can be intimidating at first, especially if you are a beginner. But once you understand the principles behind it, it is not so complicated.

The terminal commands listed below are the founding stones for your further work. They are easy to understand and remember.

  1. pwd
  2. ls
  3. cd
  4. mkdir
  5. rmdir
  6. rm
  7. !!
  8. clear
  9. sudo
  10. Tips

1. pwd

pwd - stands for print working directory. Running this command will output the path to the directory your currently in.

Nikitas-MBP:~ nikitahlopovs$ pwd
/Users/nikitahlopovs

2. ls

ls - stands for list. This command will output a list of all directories and files inside the current directory.

Nikitas-MBP:~ nikitahlopovs$ ls
Applications			Movies
Desktop				Music
Documents			Pictures
Downloads			Public
Library             
              

3. cd

cd - stands for change directory. This command is used to change directory and move around your system.

Nikitas-MBP:~ nikitahlopovs$ cd Documents/Sites
Nikitas-MBP:~ nikitahlopovs$ pwd
/Users/nikitahlopovs/Documents/Sites

Some additional change directory commands are quite useful.

  • To go to the parent directory use: cd ..
  • To go to the root directory from any location use: cd /
  • To go to the home directory from any location use: cd ~

4. mkdir

mkdir - stands for make directory. This command is used to create a directory.

Nikitas-MBP:~ nikitahlopovs$ mkdir helloWorld
Nikitas-MBP:~ nikitahlopovs$ ls
Applications			Movies
Desktop				Music
Documents			Pictures
Downloads			Public
Library				helloWorld

5. rmdir

rmdir - stands for remove directory. This command is used to remove a directory.

Nikitas-MBP:~ nikitahlopovs$ rmdir helloWorld
Nikitas-MBP:~ nikitahlopovs$ ls
Applications			Movies
Desktop				Music
Documents			Pictures
Downloads			Public
Library

6. rm

rm - stands for remove. This command is used to remove the specified directory or file.

Nikitas-MBP:~ nikitahlopovs$ rm index.php

7. !!

!! - execute the last command typed.

Nikitas-MBP:~ nikitahlopovs$ ls
Applications			Movies
Desktop				Music
Documents			Pictures
Downloads			Public
Library
Nikitas-MBP:~ nikitahlopovs$ !!
Applications			Movies
Desktop				Music
Documents			Pictures
Downloads			Public
Library

8. clear

clear - will clear the terminal screen of all the text.

Nikitas-MBP:~ nikitahlopovs$ clear

9. sudo

sudo - stands for super user do. This command will execute any command with the security privileges of the super user. The example below will execute the last typed command with the security privileges of the super user.

Nikitas-MBP:~ nikitahlopovs$ sudo !!

Tips

Below are some useful key combinations that will help you be more productive and handle terminal with ease.

  • fn + shift(⇧) + - Jump to the start of the line
  • fn + shift(⇧) + - Jump to the end of the line
  • alt(⌥) + - Jump to the previous word
  • alt(⌥) + - Jump to the next word
  • ctrl(⌃) + u - Remove all text in the current line
  • Double-clicking on the Tab button acts as an autocomplete and will offer you suggestions. This is useful when typing in a path.

Additional resources

There are a lot more than these basic terminal commands. You can learn a lot more and become very productive and efficient if you know more commands. Below just a few useful resources for you to extend your knowledge:

Like this article? Share it on: