The Terminal Commands that Every Programmer Should Know

the-terminal-commands-that-every-programmer-should-know large

Prefer to watch the video?

Learning the terminologies: Understanding what the Terminal, Console, Shell, CLI Bash, and PowerShell mean.

The console is the hardware or the system running a terminal.

  • A terminal is a session of a shell.
  • A shell is a CLI that allows you to control your computer using different commands.  
  • A CLI or Command Line Interface allows you to execute commands (input) and get results from it (output).
  • What about Bash and PowerShell?
  • Bash is one kind of Linux/Unix shell.
  • PowerShell is the windows operative system’s shell.

Although some shells have similar commands, many of the other commands are different, i.e. Bash commands are different from Powershell commands.

Executing Bash commands on Windows

There’s a way for you to execute Bash commands in a Windows machine. This is done by downloading and installing Git https://git-scm.com/downloads, which is a version control, in your Windows machine. Git comes with other tools during the installation process, Git Bash being one of them. Git Bash is an emulator of Bash in a Windows machine. That doesn’t mean you can have a Bash shell in a Windows machine. It means you can use Bash commands in a Windows machine.

It’s time for you to learn the basic commands any programmer should know.

Basic Bash commands

Note: If you are on a Windows machine, Run these commands on Git Bash. You can execute these commands in the terminal if you have a MAC without the need of Git Bash. Just make sure it says Bash in the title as soon as you open the terminal.

cd + directory name: to change directory or current location in the terminal

cd .. : to change directory one step back in the terminal

ls: to display the list of files in the current location in the terminal

clear: to clear the history of inputs and outputs displayed on the terminal

touch + myFileName : to create file with name “myFileName” in the current terminal location

rm + myFileName: to remove a file with the name “myFilename” in the current terminal location

Key Up or Down: to see previous commands executed in the terminal

cp + myFileName + newLocation: to copy the file with the name “myFileName” to a new location called “newLocation”

Basic CMD commands (Only Windows)

Note: I’m not aware of any windows shell emulator that could be used in a Linux machine. If you are on a Linux machine, you probably won’t be able to execute the following commands:

cd + directory name: to change directory or current location in the terminal

cd .. : to change directory one step back in the terminal

dir: to display the list of files in the current location in the terminal

cls: to clear the history of inputs and outputs displayed on the terminal

call >> + myFileName : to create file with name “myFileName” in the current terminal location

rm + myFileName: to remove a file with the name “myFilename” in the current terminal location

Key Up or Down: to see previous commands executed in the terminal

xcopy + myFileName + newLocation: to copy the file with the name “myFileName” to a new location called “newLocation”

I have known developers, from junior to senior developers, who don’t know how to use the terminal. Sometimes, this could be frustrating especially when they need to access virtual machines using the terminal and they don’t know the basic commands to get around. Although you don’t really need to know the terminal to become a programmer, I strongly advise you to learn the basic commands on your workstation’s shell.

Share this article or checkout our social media channels!