Difference: EverydayCommands (1 vs. 2)

Revision 2
09 Aug 2017 - Main.ForrestPhillips
Line: 1 to 1
META TOPICPARENT name="BeginnerBash"

Everyday Commands in Bash

There are several commands that you will need to learn so you can get around in a terminal. Below are a list of commands use might use everyday or almost everyday.

To learn more about these commands, you can use the command "man <command-name>" or "<command> --help", or just google it. Note: replace anything in <> with the content of interest (and then remove the <>).
Navigating through the Teminal
Navigating through the Terminal

There are two important commands you will need to know in order to navigate through a terminal. First, how to list the contents of the current directory. And second, how to move between directories.
Line: 18 to 18
Reading a File

To open a file for reading only (editing will be covered in another section on text editors), you can use the command "less <fileName>". To navigate you can use the up and down arrow keys to go line by line, or use the "u" and "d" keys to scroll up and down in half-page increments.
Figuring out where you are

If you are lost and need to know where you are in the file system, or simply need a path to copy and paste, use the command "pwd" to have path to your current directory printed to the terminal.
Moving Files

If you would like to change a file's name, use the command "mv <fileName> <newName>". If you would like to move a file to a new directory, us the command "mv <fileName> <path>".
Removing Files

To remove a file, use the command "rm <fileName>".
Making and Removing Directories

To make a new directory, use the command "mkdir <dirName>". To remove an empty directory, use the command "rmdir <dirName>". To remove a directory and all it's contents, use the command "rm -fr <dirName>" (BE VERY CAREFUL WITH THIS, THERE IS NO UNDO).

-- ForrestPhillips - 09 Aug 2017
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback