Raspberry Pi Setup · Lesson 4 of 17
Bash Basics Introduction
Creating directories
In Bash, directories can be created using the mkdir command. Here's how to do it:
mkdir new_directory
This command will create a new directory named 'new_directory' in the current directory.
Navigating directories
To navigate between directories, we use the cd command. The following command will change your current directory to the new_directory:
cd new_directory
You can return to the parent directory by using:
cd ..
And you can go to your home directory just by using cd with no arguments:
cd
Creating Files
Files can be created using the touch command:
touch new_file.txt
This command creates a new empty file `new_file.txt` in the current directory.
Editing and Saving Files
There are several text editors available in Linux that can be used to edit files; nano, vi, and emacs are a few. Here we can use
nano, which is intuitive and easy to use.
To edit a file:
nano new_file.txt
This will open the file `new_file.txt` in the `nano` editor. You can then type or paste in the text you want to save. Once you're done editing, you can save and exit the
file by pressing Ctrl + X, then Y to confirm that you want to save the changes, and then Enter to confirm the file name.