Mac terminal change to root directory

A directory is a logical section of a file system used to hold files.

What’s in a folder

Directories may also contain other directories. The cd command can be used to change into a subdirectory, move back into the parent directory, move all the way back to the root directory or move to any given directory.

How to Enable the Root user on Mac OS X 10.12 Sierra and earlier

A similar session in DOS though the concept of a "home directory" may not apply, depending on the specific version [ vague ] would look like this:. DOS maintains separate working directories for each lettered drive , and also has the concept of a current working drive.

Navigation menu

The cd command can be used to change the working directory of the working drive or another lettered drive. Typing the drive letter as a command on its own changes the working drive, e. Modern versions of Windows simulate this behaviour for backwards compatibility under CMD. Note that executing cd from the command line with no arguments has different effects in different operating systems. If cd is executed without arguments in Unix, the user is returned to the home directory. Executing the cd command within a script or batch file also has different effects in different operating systems.

In DOS, the caller's current directory can be directly altered by the batch file 's use of this command.

In Unix , the caller's current directory is not altered by the script's invocation of the cd command. This is because in Unix, the script is usually executed within a subshell. The second line is the prompt, and while it can change from system to system depending on configuration, by default it contains several bits of information. In my prompt, walden is the name of my Mac same as the name in the Sharing pane of System Preferences , and kirk is my user name. To do that you use the ls or list command.

The output of the plain ls command is pretty sparse; it shows you the names of files and folders contained in the current directory including some familiar ones such as Movies, Music, Pictures, and so on. Fortunately, you can add a number of optional switches to the ls command that allow you to see more information.

The point is that ls can provide additional information about files and folders, depending on the options you specify. In this case, that additional information includes the name of the user who owns each item in the directory.

cd (command)

The kirk kirk next to most of those items above means that each one is owned by the user kirk , who is in the group kirk. Useful for finding your current terminal location in the filesystem. Used like so: touch index. Lists all files in a directory. To view files as a vertical list use ls -l. To view all files including hidden ones use ls -a.

Used in the same way as copy cp. To remove a folder use rm -rf folder-name.

How to Enable the Root User on Your Mac - Make Tech Easier

For example, man rm will display information about the rm command. Useful Keyboard Shortcuts Tab Autocomplete a path. When entering a long path name it can be tedious to type out, hitting tab will autocomplete as much of the filename as it can match from what you have already typed. Hitting tab twice will show all options available that match what you have written. This enables quicker traversing of folders and files.

Introduction to the Linux Command Line

Useful for repeating long commands that are still in the terminal history. Useful when navigating through long commands you have typed.


  1. crockpot mac n cheese with cottage cheese.
  2. copy video from vimeo on mac.
  3. Subscribe to RSS.
  4. How to Enable the Root User on Your Mac!

Useful when needing to edit commands that are quite long. So pressing this when at the end of a line will clear the whole line. Useful when running grunt or git commands for example if you realise you don't want them to run after executing them.