Basic Terminal Commands And Their Meanings

in #stem4 years ago

There are several terminal commands and they all do different things, I am sure many of us go to stackoverflow when we run into issues and see solutions that requires you to run some commands on your terminal to fix them. I will attempt to work you through some of the more simpler terminal commands you can know to make your dev experience easier.

Basically your terminal is like a file explorer, which can allow you do CRUD operations on files and folders. There are lots of commands to help achieve whatever we are trying to do on a folder or file. Listed below are some commands and their meanings.

hr.png

cd and pwd

Trust me, both are not acronyms for compact disk and password respectively . Both are probably the most useful commands you will always need.

cd stands for change directory, say you have a folder named Arsenal in your Downloads folder, if you want to do anything on the Arsenal folder, you will have to change your directory from wherever you are currently to Arsenal.

When you open your terminal, you are always in the Home directory. To cd into Arsenal from Home, run the following command, cd downloads/arsenal. To go out of Arsenal into Downloads all you have to is run cd .. which will always take you back one folder and run cd to go to Home.

pwd is short for print working directory , to know which directory you’re currently on, you run pwd which returns an absolute path from the home directory to your current directory.

mkdir and rmdir

If you need to create a directory, you will use the mkdir command which is an acronym for make directory and rmdir aka remove directory, if you need to delete a directory. But note, rmdir will only remove an empty folder.

Examples, mkdir Downloads/newFolder will create newFolder in the downloads folders and rmdir Downloads/newFolder will remove the newFolder if it is empty from the downloads folders.

touch and ls

touch is used to create a new file in the current directory , touch newfile.js will create a js file in the directory.

ls short for list is used to display all the contents in a directory, ls downloads will return all files in the directory . ls can also take a -a flag to display hidden files and folders in a directory .

hr.png

Tl;dr

commandfunction
cdchange directory
pwdprint working directory
mkdirmake directory
rmdirremove directory
touchcreate new file
lsknow what files are in the directory you are in

Have fun ✌🏻✌🏻

Sort:  

Have a witness !BEER

Coin Marketplace

STEEM 0.21
TRX 0.25
JST 0.038
BTC 96989.50
ETH 3378.64
USDT 1.00
SBD 3.23