🔶What is Linux?
Linux is a free, open-source operating system that helps run your computer or device. It works on kernel. It manages the hardware and software, allowing everything to work together smoothly. It's like the "brain" of the device, and since it's open-source, It’s free to use and can be customized by anyone, and share it.
🔶Linux Architecture :
Apps -> Shell -> Kernel -> Hardware
🔶Basic Commands For Linux :
- Display the username of the currently logged-in user -
ubuntu@ip-172-31-46-195:~$ whoami
- Creates a new, empty file - (touch)
ubuntu@ip-172-31-46-195:~$ touch mazi_file.txt
- Lists files and directories in the current directory - (ls)
ubuntu@ip-172-31-46-195:~$ ls
- Displays the path of current directory - (pwd)
ubuntu@ip-172-31-46-195:~$ pwd
- Create new directories - (mkdir)
ubuntu@ip-172-31-46-195:~$ mkdir gayatri
- To move into a directory - (cd)
ubuntu@ip-172-31-46-195:~$ cd gayatri/
- Moves up to the parent directory of the current directory - (cd .. )
ubuntu@ip-172-31-46-195:~/gayatri$ cd ..
- Move Files or Directories - (mv)
ubuntu@ip-172-31-46-195:~/gayatri$ mv ../mazi_file.txt .
- Create and Edit Files - (nano)
ubuntu@ip-172-31-46-195:~/gayatri$ nano mazi_file.txt
- Display File Contents - (cat)
ubuntu@ip-172-31-46-195:~/gayatri$ cat mazi_file.txt
- Display Text - (echo)
ubuntu@ip-172-31-46-195:~/gayatri$ echo "Hello world"
- Delete a File - (rm)
ubuntu@ip-172-31-46-195:~/gayatri$ rm mazi_file.txt
- To Clear the Terminal Screen - (clear)
ubuntu@ip-172-31-46-195:~$ clear
- View Command History - (history)
ubuntu@ip-172-31-46-195:~$ history
- View Manual for a Command -(man)
ubuntu@ip-172-31-46-195:~$ man ls
- Copy Files and Directories - (cp)
ubuntu@ip-172-31-46-195:~$ cp newfile.txt devops/
- Extract sections from lines of text - (cut)
ubuntu@ip-172-31-46-195:~/devops$ cut -b 1-4 newfile.txt
- Print input and output on screen and also in file - (tee)
ubuntu@ip-172-31-46-195:~/devops$ echo "hello" | tee hellow.txt
- Sort data alphabetically, numerically - (sort)
ubuntu@ip-172-31-46-195:~/devops$ sort newfile.txt
- Compare the contents of two files line by line -(diff)
ubuntu@ip-172-31-46-195:~/devops$ diff newfile.txt hellow.txt
- Creating and modifying text files - (vi editor)
ubuntu@ip-172-31-46-195:~$ vi newfile.txt
Â