User Tools

Site Tools


networkops:linux_navigation

Basic Navigation in BASH

  1. Useful Commands
    1. pwd
      print working directory\\PWD should be done any time you are unsure what directory you are in.
    2. ls -a
      This will print all folders in a file that can be accessed by going down the chain.
  2. Root and /
    In short the / folder is the root of the file system. Where as the /root/ folder is the home folder of the root user. This is why when we are navigating and using cd when we want to go to a different directory we use the root (/) folder to back to the root of the system. Once there we can then go to whatever folders we wish.
  3. Examples of Navigation

Say we had this directory tree.

/
	etc/
		httpd/
			httpd.config/
	home/
		"username"/
				bar/
	root/

So if we wanted to go from etc to bar in one line we would use the following steps. first we run pwd to see that we are in the etc folder.

[allent@localhost etc]$ pwd
/etc

This confirms that we are in the etc directory.

We then run this command which will move us first to the root directory, then to the home directory, then to the user directory then to the directory we want.

[allent@localhost etc]$ cd /home/allent/bar

This command then returns us here

[allent@localhost bar]$

Which is where we wanted to be in the first place.

Wrapping up

Linux is an adaptable Operating System that uses a tree data structure to orient itself and its files. If you tell it to go to the root which is denoted as / you can go anywhere in the computer as long as you have the right permissions.

You may also want to look at the following videos that give an in depth look at Create Update Delete and Retrieve operations in BASH and Linux. There are some minor differences between CENTOS and the BASH Command line but they are not to hard to adapt.

Linux Shell Command Arguments
Linux Server Administration - Secure Shell Server Overview
Linux File Management
NetSecProf Youtube Profile

networkops/linux_navigation.txt · Last modified: 2019/04/03 22:26 by tima