Absolute Path

An absolute path is an absolute path that starts from the root directory. The word path contains both the file name and the directory name.

# Absolute path
/home/kimoto
/var
/var/log
/usr
/usr/local

/home/kimoto/foo.txt
/home/kimoto/foo/bar.pl
/home/kimoto/foo/bar/baz.tar.gz

Linux recognizes paths starting with "/" as absolute paths. Note that unlike relative path, it starts with a "/".

Sample using absolute path

Use absolute path with cd command

This is a sample that uses the absolute path in the cd command.

cd /home/kimoto/foo/bar

Change the current directory to "/home/kimoto/foo/bar".

Use absolute path with ls command

This is a sample that uses the absolute path in the ls command.

ls /home/kimoto/foo/bar

Display a list of files that exist in "/home/kimoto/foo/bar".

Use absolute path for other commands

touch command, mkdir command, rmdir command and the rm command.

touch /home/kimoto/foo/bar
mkdir /home/kimoto/foo/bar
rmdir /home/kimoto/foo/bar
rm /home/kimoto/foo/bar

Associated Information