๐ŸงDay 2 - Basics of Linux Commands๐Ÿ’ปโŒจ๏ธ

๐ŸงDay 2 - Basics of Linux Commands๐Ÿ’ปโŒจ๏ธ

Day 02 #90daysofDevops Challange

ยท

11 min read

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

  1. Free and Open-Source: ๐Ÿ”„ Linux's popularity arises from its open-source nature, allowing users to access, modify, and distribute the source code freely.

  2. 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.

  3. 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.

  4. 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.

Basics Linux Commands

LINUX DISTRIBUTIONS:

  1. Ubuntu: This one is good for people who are new to Linux, user friendly with a range of features

  2. Fedora: This version is all about using the newest software. People who like to be on the cutting edge of technology usually prefer Fedora.

  3. 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.

  4. 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.

  5. 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 ๐Ÿ›๏ธ

  1. 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.

  2. 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 ๐Ÿ“‚.

  3. 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 ๐ŸŽต.

  4. Hardware ๐Ÿ–ฅ๏ธ: Hardware encompasses physical components like processors, memory, storage devices, and input/output devices (e.g., keyboard, mouse).

  5. Utilities ๐Ÿ› ๏ธ: Utilities are specialized programs and tools that perform specific tasks, such as file management, system monitoring, and network configuration.

Linux Basic Commands:

  1. pwd--> Print current working directory.

  2. ls--> List files in the current directory. It shows available files and directory lists in the present working directory.

  3. cd--> change directory.

  4. mkdir--> Create a new directory.

  5. touch--> Create an empty file

  6. cp--> Copy files or directory.

  7. mv--> Move or rename files or directories.

  8. cat--> Display the content of a file.

  9. man--> Display the manual for a commands.

  10. echo--> Print text to the terminal.

  11. chmod--> Change the permissions.

  12. chown--> Change file ownership.

  13. ps--> Display currently running processes.

  14. kill--> Terminate a process.

  15. grep--> Search for a pattern in files.

  16. find--> Search for files and directories.

  17. tar--> Create or extract tar archives.

  18. gzip--> Compress or decompress files.

  19. df--> Display disk space usage.

  20. du--> Display file and directory space usage.

  21. ifconfig--> Display network interface information.

  22. ping--> Tast network connectivity.

  23. ssh--> Connect to a remote server ( secured shell )

  24. scp--> Copy file over SSH ( secured copy shell )

  25. wget--> Download files from the internet.

  26. top--> Display real-time system statistice.

  27. history--> Display commands history.

  28. nano--> Simple text editor.

  29. clear--> Clear the terminal screen.

  30. df--> Display disk space usage.

  31. date--> Display or set the system date and time.

  32. cal--> Display a calendar.

  33. uname--> Display system information.

  34. head--> Display the beginning of a file. It is used for printing the first ten lines(by default) of a text file.

  35. tail--> Display the end of a file. It is used to display the last ten lines(by default) of a text file.

  36. wc--> Count lines, words, and characters in a file.

  37. sort--> Sort lines of text files.

  38. whoami--> Display the current username.

  39. pwd--> Print current working directory.

  40. file--> Determine file type.

  41. alias--> Create commands history.

  42. uptime--> Display system uptime.

  43. ls -l--> List files with detailed information. It is used for knowing the details of files and directories.

  44. mkdir -p--> Create Parent directory as nested.

  45. rmdir--> Remove an empty directory.

  46. passwd--> Change user password.

  47. reboot--> Reboot the system.

  48. ls option_flag arguments --> list the sub directories and files avaiable in the present directory

  49. ls -a --> list all including hidden files and directory. It is used for showing the list of all the hidden files.

  50. ls *.sh --> list all the files having .sh extension.

  51. ls -i --> list the files and directories with index numbers inodes

  52. ls -d */ --> list only directories.(we can also specify a pattern)

  53. cd path_to_directory --> change directory to the provided path

  54. cd ~ or just cd --> change directory to the home directory

  55. cd - --> Go to the last working directory.

  56. cd .. --> change directory to one step back. It is used to move one directory back from the present directory.

  57. cd ../.. --> Change directory to 2 levels back. It is used to move two previous directories from the present directory.

  58. mkdir directoryName --> to make a directory in a specific location.

  59. vim -> It is used as an editor to create or edit a text file.

  60. rm -> It is used to remove the file.

  61. rm -r -> It is used to remove the directory.

  62. tree -> It is used to display the file system's directory structure in a tree-like format.

  63. sudo -> It is used to run commands with administrative privileges.

  64. useradd -> It is used for creating a new user account.

Top 50+ Linux Commands You MUST Know | DigitalOcean

๐Ÿ“„ 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 directory

  • ls -l--> list the files and directories in long list format with extra information

  • ls -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 path

  • cd ~ or just cd --> change directory to the home directory

  • cd - --> 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:

  1. rm (Remove):

    • Deletes files or directories.

    • Example: rm file.txt (to delete a file)

    • Example: rm -r folder (to delete a directory)

  2. pwd (Print Working Directory):

    • Displays the current working directory.

    • Example: pwd (to show the current directory path)

  3. cp (Copy):

    • Copies files or directories.

    • Example: cp file.txt newfile.txt (to copy file.txt to newfile.txt)

  4. mv (Move):

    • Moves files or directories.

    • Example: mv file.txt Documents (to move file.txt to the Documents directory)

  5. touch (Create Empty File):

    • Creates a new empty file.

    • Example: touch file.txt (to create a file named file.txt)

  6. whoami (Show Current User):

    • Displays the username of the current user.

    • Example: whoami

  7. echo (Print Text):

    • Displays text or variables to the terminal.

    • Example: echo "Hello, World!"

  8. history (Command History):

    • Shows a list of previously executed commands.

    • Example: history

  9. sudo (Superuser Do):

    • Executes a command with superuser privileges.

    • Example: sudo apt-get update

  10. cat (Concatenate Files):

    • Displays the contents of a file.

    • Example: cat file.txt

  11. vim (Text Editor):

    • Opens the Vim text editor to create or edit files.

    • Example: vim file.txt

  12. clear (Clear the Terminal):

    • Clears the terminal screen.

    • Example: clear

  13. Working with Permissions:

    • chmod: Change file permissions.

    • chown: Change file ownership.

  14. Network Operations:

    • ping: Check network connectivity.

    • ifconfig and ip: Network interface configuration.

    • ssh: Securely access remote systems.

  15. System Information and Monitoring:

    • uname: Display system information.

    • top and htop: Monitor system resources.

  16. Searching and Filtering:

    • grep: Search for patterns in files.

    • find: Search for files and directories.

    • wc: Count words, lines, and characters in files.

  17. Viewing and Editing Files:

    • less and more: View files page by page.

    • nano and vi: Text editors for editing files.

  18. Package Management:

    • apt and apt-get: Package management on Debian-based systems.

    • yum: Package management on Red Hat-based systems.

๐ŸŒŸDay 02 #90DaysOfDevOps Challenge ๐Ÿš€๐Ÿ‘จโ€๐Ÿ’ป

Linux History And Basics Linux Command

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! ๐ŸŽ‰

๐ŸŽฏDay 2 - Unveiling the World of Linux! ๐Ÿง

_____________________________________________________________________________________

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! ๐Ÿ’š

-RhythmDevOpsBlogs๐Ÿ’

ย