๐งDay 2 - Basics of Linux Commands๐ปโจ๏ธ
Day 02 #90daysofDevops Challange
A Brief History
Linux is a powerful open-source operating system kernel developed by Linus Torvalds in 1991, known for its stability, security, and flexibility, widely used in servers, embedded systems, and desktops.๐ง๐ก๐ฅ๏ธ๐๐ It boasts a large, active community contributing to its development and improvement.๐๐ค๐ ๏ธ Originating as a cool cousin of Unix, it was freely created by Torvalds in September 1991. ๐ As a University of Helsinki student, Linus shared Linux 0.01 with the Minix group on September 17, 1991, leading to enthusiastic support for more development, culminating in the "official" version 0.02 launch on October 5, 1991.๐ซ๐ฎ๐๐๐จโ๐ป๐๐ป
๐ก: Linux is open-source, unix-like operating system. In initial days it's only a kernel.
๐คWhat is Linux?
Linux is an operating system that is both versatile and powerful. It is free and open-source software that is based on the Unix operating system and was created by Linus Torvalds in 1991. The stability, scalability, and cost-effectiveness of Linux make it a popular choice for various applications and industries.
"Linux is not about Windows. It's about choice."
- Linus Torvalds
๐Why is Linux so popular over another operating system?
Free and Open-Source: ๐ Linux's popularity arises from its open-source nature, allowing users to access, modify, and distribute the source code freely.
Secure: ๐ Security is a hallmark of Linux. Its strong permission system, regular updates, and dedicated community contribute to a secure computing environment, making it a preferred choice for many.
Fast: โก Linux is well-known for its efficiency and speed. Its lightweight design and optimized kernel contribute to swift performance, making it an ideal choice for various computing tasks.
Many Distributions: ๐There are tons of Linux distributions available such as Ubuntu, CentOS, Red Hat, Debian, and Fedora, which make Linux a popular operating system.
LINUX DISTRIBUTIONS:
Ubuntu: This one is good for people who are new to Linux, user friendly with a range of features
Fedora: This version is all about using the newest software. People who like to be on the cutting edge of technology usually prefer Fedora.
Debian: If you want an operating system that doesn't crash and is all about being open and free, Debian is a good choice. Many other Linux versions are based on Debian.
CentOS: This version is made for big servers and businesses. It's stable and gets long-term support, meaning it'll be taken care of for a long time.
Kali Linux: This one is made specifically for cybersecurity and testing security. It has a lot of tools built in for finding vulnerabilities and checking how secure things are.
Architecture of Linux ๐๏ธ
Kernel ๐ง : The kernel serves as the heart of the Linux operating system, responsible for managing hardware resources, memory, and system processes.The Linux Kernel is written in C Language and it talks directly with the hardware. All the commands that run on a Linux system are written in C and stored in the kernel.
Shell ๐: The shell is a command-line interface that allows users to interact with the kernel by entering commands and executing scripts. Shell accepts human-readable commands ๐ from users and converts them into something which the kernel can understand ๐ง . It is a command language interpreter ๐ฅ๏ธ that executes commands read from input devices such as keyboards โจ๏ธ or from files ๐.
Application ๐ฑ: Applications are software programs designed for end-users to perform various tasks, ranging from productivity tools like word processors and spreadsheets๐ to entertainment software like web browsers ๐ and media players ๐ต.
Hardware ๐ฅ๏ธ: Hardware encompasses physical components like processors, memory, storage devices, and input/output devices (e.g., keyboard, mouse).
Utilities ๐ ๏ธ: Utilities are specialized programs and tools that perform specific tasks, such as file management, system monitoring, and network configuration.
Linux Basic Commands:
pwd
--> Print current working directory.ls
--> List files in the current directory. It shows available files and directory lists in the present working directory.cd
--> change directory.mkdir
--> Create a new directory.touch
--> Create an empty filecp
--> Copy files or directory.mv
--> Move or rename files or directories.cat
--> Display the content of a file.man
--> Display the manual for a commands.echo
--> Print text to the terminal.chmod
--> Change the permissions.chown
--> Change file ownership.ps
--> Display currently running processes.kill
--> Terminate a process.grep
--> Search for a pattern in files.find
--> Search for files and directories.tar
--> Create or extract tar archives.gzip
--> Compress or decompress files.df
--> Display disk space usage.du
--> Display file and directory space usage.ifconfig
--> Display network interface information.ping
--> Tast network connectivity.ssh
--> Connect to a remote server ( secured shell )scp
--> Copy file over SSH ( secured copy shell )wget
--> Download files from the internet.top
--> Display real-time system statistice.history
--> Display commands history.nano
--> Simple text editor.clear
--> Clear the terminal screen.df
--> Display disk space usage.date
--> Display or set the system date and time.cal
--> Display a calendar.uname
--> Display system information.head
--> Display the beginning of a file. It is used for printing the first ten lines(by default) of a text file.tail
--> Display the end of a file. It is used to display the last ten lines(by default) of a text file.wc
--> Count lines, words, and characters in a file.sort
--> Sort lines of text files.whoami
--> Display the current username.pwd
--> Print current working directory.file
--> Determine file type.alias
--> Create commands history.uptime
--> Display system uptime.ls -l
--> List files with detailed information. It is used for knowing the details of files and directories.mkdir -p
--> Create Parent directory as nested.rmdir
--> Remove an empty directory.passwd
--> Change user password.reboot
--> Reboot the system.ls option_flag arguments
--> list the sub directories and files avaiable in the present directoryls -a
--> list all including hidden files and directory. It is used for showing the list of all the hidden files.ls *.sh
--> list all the files having .sh extension.ls -i
--> list the files and directories with index numbers inodesls -d */
--> list only directories.(we can also specify a pattern)cd path_to_directory
--> change directory to the provided pathcd ~
or justcd
--> change directory to the home directorycd -
--> Go to the last working directory.cd ..
--> change directory to one step back. It is used to move one directory back from the present directory.cd ../..
--> Change directory to 2 levels back. It is used to move two previous directories from the present directory.mkdir directoryName
--> to make a directory in a specific location.vim -> It is used as an editor to create or edit a text file.
rm -> It is used to remove the file.
rm -r -> It is used to remove the directory.
tree -> It is used to display the file system's directory structure in a tree-like format.
sudo -> It is used to run commands with administrative privileges.
useradd -> It is used for creating a new user account.
๐ Basic Listing Commands ๐๏ธ
Now, let's explore some basic listing commands that you can use in Linux:
Listing commands
ls option_flag arguments
--> list the sub directories and files avaiable in the present directoryls -l
--> list the files and directories in long list format with extra informationls -a
--> list all including hidden files and directory.ls *.sh
--> list all the files having .sh extension.ls -i
--> lists the files and directories along with their corresponding inode numbers.ls -d */
--> list only directories. (we can also specify a pattern)
Directory Commands
pwd
--> print work directory. Gives the present working directory.cd path_to_directory
--> change directory to the provided pathcd ~
or justcd
--> change directory to the home directorycd -
--> Go to the last working directory.cd ..
--> change directory to one step back.cd ../..
--> Change directory to 2 levels back.mkdir directoryName
--> to make a directory in a specific location.
Some Fundamental Comments:
rm
(Remove):Deletes files or directories.
Example:
rm file.txt
(to delete a file)Example:
rm -r folder
(to delete a directory)
pwd
(Print Working Directory):Displays the current working directory.
Example:
pwd
(to show the current directory path)
cp
(Copy):Copies files or directories.
Example:
cp file.txt newfile.txt
(to copyfile.txt
tonewfile.txt
)
mv
(Move):Moves files or directories.
Example:
mv file.txt Documents
(to movefile.txt
to theDocuments
directory)
touch
(Create Empty File):Creates a new empty file.
Example:
touch file.txt
(to create a file namedfile.txt
)
whoami
(Show Current User):Displays the username of the current user.
Example:
whoami
echo
(Print Text):Displays text or variables to the terminal.
Example:
echo "Hello, World!"
history
(Command History):Shows a list of previously executed commands.
Example:
history
sudo
(Superuser Do):Executes a command with superuser privileges.
Example:
sudo apt-get update
cat
(Concatenate Files):Displays the contents of a file.
Example:
cat file.txt
vim
(Text Editor):Opens the Vim text editor to create or edit files.
Example:
vim file.txt
clear
(Clear the Terminal):Clears the terminal screen.
Example:
clear
Working with Permissions:
chmod
: Change file permissions.chown
: Change file ownership.
Network Operations:
ping
: Check network connectivity.ifconfig
andip
: Network interface configuration.ssh
: Securely access remote systems.
System Information and Monitoring:
uname
: Display system information.top
andhtop
: Monitor system resources.
Searching and Filtering:
grep
: Search for patterns in files.find
: Search for files and directories.wc
: Count words, lines, and characters in files.
Viewing and Editing Files:
less
andmore
: View files page by page.nano
andvi
: Text editors for editing files.
Package Management:
apt
andapt-get
: Package management on Debian-based systems.yum
: Package management on Red Hat-based systems.
๐Day 02 #90DaysOfDevOps Challenge ๐๐จโ๐ป
Welcome to the #90DaysofDevOps challenge led by Shubham Londhe ! ๐Today marks Day 2 my journey with the #TrainWithShubham Community. ๐๐จโ๐ป
Day2: TASK
1. Check your present working directory:
- To see where you are in the computer, use the following command:
pwd
2. Listing Everything, Including Hidden Files:
- To list all files and folders, even the hidden ones, use:
ls -la
3. Creating Nested Folders:
- To organize your files into nested folders, use:
mkdir -p A/B/C/D/E
Basic Commands:
/ is your root directory
~ is your home directory
1. pwd : it show present working directory
2. ls : it show available files and directory list in present working directory.
3. uname : it show name of kernel (OS)
4. uname -r : it show version of kernel
5. cd : it use for change directory
6. clear : it use for clear screen
7. whoami : it show currently login user name
8. history : it show list of previously used commands
9. date : it show time and date
10. users : Display the username of all users currently logged on the system
11. Clear : Clear Screen
12. lastlog : The lastlog command is used to find the details of a recent login of all users
13. Tail : This command prints the last N number of data of the given input. By default, it prints 10 lines.
14. Chmod : This command is used to change the access permissions of files and directories.
15. Chown : This command is used to change the file Owner or group.
16. Cut : This command is used to extract specific fields or columns from a file or standard input.
Conclusion:
These basic Linux commands serve as the building blocks ๐๏ธ for navigating ๐งญ and managing ๐ ๏ธ your Linux system effectively. By understanding their usage and practicing with examples, you'll gradually become more proficient ๐ in harnessing the power โก of the Linux command line. Remember, experimentation ๐ฌ is key to mastery ๐, so don't hesitate to explore ๐ additional commands and functionalities as you embark on your Linux journey. Happy command-line adventures! ๐
_____________________________________________________________________________________
Thank you for taking the time to read this blog. I hope you found valuable insights! If you enjoyed the content, please consider giving it a like, sharing it, and following for more insightful posts in the future. Your support means a lot! Looking forward to sharing more knowledge with you! ๐
๐A special thanks to Shubham Londhe #TrainWithShubham and the DevOps community for organizing this fantastic initiative. Let's learn, grow, and make a difference through DevOps!
Shubham Londhe #TrainWithShubham #90daysofdevops #automation #Devops #Scaling #Infrastructure #ContinuousLearning #DevOpsJourney #CommunityDriven #LinkedInPost #shubhamlondhe #devopsengineer #awsdevops
Let's Connect..!
๐LinkedIn
๐Twitter
๐GitHub
:)Happy Learning...
Thank you for reading! ๐