Tag: terminal

How to use the command CD in Linux Terminal – Ubuntu, Fedora, CentOS

The command CD stands for change directory. CD can be used in many ways to navigate between multiple directories just like we traverse in GUI.

cd <filename>

The above command will move to the directory specified in the angular brackets. But you have to make sure that the name given here is present in the current directory. You can see what are the folders/files in the current directory using the command LS. Also you can check your current working directory using the command PWD.

cd /path/to/another/folder

The above command will take to another folder that is far away from the current working directory. Make sure that the specified path exists. You can check the path of the current structure using the command TREE.

cd ..

The above command will move the current working directory to one level back.

cd 

The above command without any arguments will take you to the home directory no matter where your current working directory is.

There is a video example for the same, watch it below

How to use “ls” command in Linux terminal

“ls” means list contents of a directory. We have various options with ls that can be used together to view files in a convenient way according to our requirement.

ls -a

ls with -a option shows all hidden files.

ls -l

ls with -l prints long listing format about each file. It consists of information like permissions(read/write/execute), owner, file size, file type(directory or file or symbolic link), last modified time and the name of the file.

ls -l can be used with another options like -t or/and -r. “-t” will sort files by modified time and “-r” reverses the order they are being sorted.

To view examples for above commands see the video below.

How to use bc command for addition, subtraction, multiplication and division. Use Linux terminal as calculator

Linux command line is very powerful. Let us see how can we use it as a calculator.

Open a terminal window and write bc -ql.

Here there are two options. ‘q’ stands for quiet mode which means it doesnot print un necessary things. ‘l’ stands for mathlib which will operate mostly on decimals and other maths operations.

For addition.

For Subtraction

For Multiplication

For division

To quit the bc command type in ‘quit’.

To do more using bc command open man bc there you can see about more of its usage.