Given a sample filesystem:
/
|----/usr
|--------/bin
|--------/local
|------------/bin
|----/var
|--------/log
|--------/lib
|----/home
|--------/idbentley
|------------/development
|----------------/appacademyAnd knowing:
I can navigate to the appacademy directory with the command:
Knowing that we are in an empty development directory, I want to create a new directory for my project ChewbaccaCat. I know I can use the mkdir tool, so I try
Dern, typos! I can use mv (i.e move) to rename a file or folder, however.
$ mv ChewbaccoCat ChewbaccaCat
$ cd ChewbaccaCat
$ pwd
/home/idbentley/development/ChewbaccaCat
$ git initOne option using grep with the -c (count) opt
Or we can pipe | the output of grep into the word count command wc -l to count the number of matched lines
-c stands for “count”. It will limit the output of grep to just the number of matches, not the matches themselves.-r is unsurprisingly “recursive”, and it will tell grep that it should search the contents of any directories it receives as input.-b stands for “byte-offset” and it will tell you the line number, and position of grep’s matches.Easy as pie
To open nano, we point the nano command at the file we wish to open
Nano uses Ctrl + <command> keyboard shortcuts to utilize it’s functions.
We use Ctrl + o to save a file - Nano will prompt you for the buffer name (Nano calls files “buffers” for historical reasons).
To exit Nano without saving, you can use Ctrl + x.
If we want to save the file, we can use the the -o option.
To read the current value of path, use the echo command
The $PATH variable is split on : characters, resulting in an array of paths, which should be read from left to right. When your OS is looking for a command to run, it will walk through this array, checking each path in turn.
Bash Profile is run whenever we run a login shell.
bashrc is run for every shell
For example:
Any use of sudo rm is potentially a dangerous mistake!
Install system packages is a safe and necessary use of sudo
Installing npm packages with sudo is almost always gonna mess up your env.
We write our simple script to whoami.sh
Now we want to run whoami.sh