Essential terminal commands

Here I will list some general commands which will help you to work inside a terminal and give you the abilities to control your Linux box via terminal. These commads might also come useful if you are using your Linux desktop without a display manager (see more from this post:https://www.techtimejourney.net/?p=622)

Remember this: what happens in terminal usually stays in terminal. If you accidentally delete something then it is gone for good. So caution is adviced.

Listing directory contents:

ls = list directory contents. As a default this command makes folders and files appear with different colors.
dir = Another way of listing directory contents and files. This command shows everything with a similar color.
dir -a = List directory contents and files. This command also shows hidden files and folders (the ones which have . as a prefix)

Folder commands and moving things:

cd somefolder = move inside somefolder
cd .. = move out from a folder
mv something somelocatin = move something to somelocation
mv something.file something.file = replace something.file with something.fileĀ  Note: this is an overwrite command. The file which is located in the destination will be overwritten.

mkdir folder = make a new folder called folder
mkdir -p folder/new = make a new folder called folder which has a folder called new in it.
rm -rf folder = delete a folder or file

Ownership and changing user:

chown -hR username folder = Change the ownership of a folder to a username: replace the folder with an actual folder and username with the desired username.
chmod +x = make a file executable.
su username = change to a user

Power off and reboot:

sudo halt -p = shutdown the computer immediately.
sudo reboot = reboot the computer immediately.

These commands should get you started. This list might also see some updates in the future to come so don’t forget it.

Ending a session or a program instantly

sudo killall conky= shutdown the program conky

sudo killall openbox= shutdown or quit openbox session

sudo killall lwm= shutdown or quit lwm session

sudo killall fluxbox= shutdown or quit fluxbox session

sudo killall jwm= Shutdown or quit jwm session