Linux Bash Directories and Changing Current Working Path – POFTUT

Linux Bash Directories and Changing Current Working Path

[rps-include post=6835]

A simple shell command echo pof tut consist of command itself followed by arguments, separated by spaces. Also more complex command can be created. Generally simple commands are used and after execution exit status is provided by wait pid.

$ echo pof tut 
pof tut

Directories and Paths

While working with bash we use paths, file names, directories etc. As you can see below there is a tilde ~ at the end of the prompt which means current working directory is home of the current user.

[ismail@lenovo ~]$

You may want to change directory. cd is command used to change directory. For example to change into /etc run following command.

[ismail@lenovo ~]$ cd /etc 
[ismail@lenovo etc]$

We changed only single level directory but there are alternatives like changing more than one level directory.

[ismail@lenovo ~]$ cd /etc/systemd/
[ismail@lenovo systemd]$

Simple way to go current users home directory is just issuing cd command. After issuing command we can see tilde that means current users home directory.

[ismail@lenovo etc]$ cd 
[ismail@lenovo ~]$

As you know directories are a tree hierarchy. To go upper directory cd .. command is used. In bash .. mean upper/parent directory.

[ismail@lenovo ~]$ cd .. 
[ismail@lenovo home]$

To point current working directory . is used. When calling a script that resides in current directory the following command is given.

$ ./

[rps-include post=6835]

LEARN MORE  Linux pwd Command Tutorial With Examples

Leave a Comment