Bash Basics Introduction

Introduction to Bash Command Line Basics

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.

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.

Co funded by the EU

Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Education and Culture Executive Agency (EACEA). Neither the European Union nor EACEA can be held responsible for them.

Project Number: 2023-3-CY02-KA210-YOU-000173087