Site icon NetworkHunt

Basic commands in linux

Ls (list directories)

*This command is used to list all the files and directories under a directory.

Header and switches of ls command-

Cd command(change directory)

This command allows you to change directories in Linux, making it easier to navigate through the file system and manage your files efficiently.

To change your path from one directory to another use (cd)command in linux (cd [directory name])replace the directory name with the desired directory in which you want to enter

Suppose directory name is profile

-Now suppose the user want to go to a file or directory which has a long path for long paths user can again use cd command to reach the desired location just by using ‘/’ for example a directory is in some another directory where the directory is located user is supposed to give command like this-

– Use of ‘.’  ’..’

It is the most commonly used command for cd command as it is used to go in previous directory or file use for the ‘.’ and ‘..’ is very easy single ‘.’ Takes the user to just one step back to the previous directory or file whereas ‘..’ takes the user two step back.

Pwd command (print working directory)

 This command is very commonly and very usefully used by the user as it helps the user to Print the full filename of the current working directory and also It prints the path of the current working directory.

It has 2 flags

Pwd -L =provides the path with symlinks

Pwd -p=provides the clear path without symlinks

Note: symlinks are the symbolic linux/UNIX link that points to another file or directory in your system.

Pwd -L(logical) : Shows the logical path which includes symbolic links. This option respects any symbolic links in the path, means if you navigate to the current directory through a symbolic link, pwd -L command will display the path with the symbolic link.

Pwd -P(physical): Shows the physical path, which resolves symbolic links to their real path, underlying paths. This option outputs the actual directory structure on disk, by not printing any symbolic links.

Exit mobile version