# Linux Bash Commands


Linux is the major choice of operating system for most of the computers worldwide, particularly in servers. This is for many reasons, the most important one being free and open-source. Because this is open-source, communities can add features and logic on top of Linux, according to their taste and choice, while leaving the main Linux Kernel undisturbed. 

Linux a shell, a Command Line Interface, known mostly as BASH(**B**ourne **A**gain **SH**ell). Although people have created many alternatives to this shell, the main language under the hood is mostly the same. The BASH accepts commands as user input and then executes it. Because, Linux is very common in cloud servers and work stations, it is essential to learn and practice important commands of BASH, in order to operate a task in Linux, in the most efficient manner as possible. In Linux, directories are the same as folders.  

In Linux, the general syntax for a command is case-sensitive and as follows:  
**command [-flag(s)] [-option(s) [value]] [argument(s)]**  

Relative paths begin with no slashes but absolute paths begin with "**/**"  


"**.**" represents **current directory**, "**..**" represents one level above the current directory, "**-** represents the previous directory


1. ### View current working directory
  **pwd**  
  e.g. pwd
  
2. ### Change working directory
  **cd folder_name**  
  e.g. cd folder_2

3. ### Change to one level above the current directory  
  **cd ..**  
  e.g. cd ..

4.  ### List down the contents of a directory
  **ls**  
  e.g. ls

5. ### List down the contents of a directory in compact form
  **ls -l**  
  e.g. ls -l

6. ### List down the contents of a directory, sorted by size
  **ls -s**

7. ### Output text on terminal
  **echo text_here**  
  e.g. echo Hello World!

8. ### Create a directory
  **mkdir folder_name**  
   e.g. mkdir folder 2

9. ### Create a file
  **touch file_name**  
  e.g. touch file.txt

10. ### Copy file to a directory
  **cp file_name folder_name**  
  e.g. cp hello.word folder2

11. ### Delete a file from a directory
  **rm file_name**  
  e.g. rm hello.txt

12. ### Delete a directory (be careful when removing directories recursively, as it may potentially destroy the operating system)
  **rm -r folder_name** 
  e.g. rm -r folder1

13. ### Move a file to a directory
  **mv file_name folder_name**  
 e.g. mv hello.txt folder2

14. ### Rename a file
  **mv file_name new_file_name**  
  e.g. mv hello.txt hello.word

15. ### View content of a file
  **more file_name**  
  e.g. more hello.word

16. ### View the file tree of a directory
  **find folder_name**   
  e.g. find folder3

17. ### Change to two levels above the current directory
  **cd ../..**

18. ### Change to a directory within another directory
  **cd folder_name/other_folder_name**  
  e.g. cd folder1/folder2

19. ### View path of a file within a directory
  **find -name file_name**  
  e.g. find -name hello.word

20. ### View path of a directory within a directory
  **find -name file_name**  
  e.g. find -name folder2

21.  ### Remove an empty directory
  **rmdir folder_name**  
  e.g. rmdir folder3

22. ### Append output of echo command to a file
  **echo Hello World! >> file_name**  
  e.g. echo Hello! >>  hello.txt




 
  
  

