Sandbox is not supported on mobile, try on a computer
In this hands-on lab, we'll embark on a journey through the Linux command-line environment. You'll learn to navigate the file system, manipulate files and directories, and perform basic administrative tasks. By the end of this lab, you'll have a solid foundation in Linux commands that will empower you to work efficiently in the terminal.
Prerequisites:
No prior Linux knowledge is required, but a basic understanding of computer systems is beneficial. If you're new to Linux, this lab is a perfect starting point to gain valuable command-line skills.
Linux Basics
Linux, the powerful open-source operating system, is the cornerstone of the digital world. It's like a versatile toolbox for your computer, enabling you to wield command-line magic and take control of your system. Whether you're a beginner or looking to sharpen your Linux skills, this lab is your gateway to mastering essential Linux commands.
Key Topics:
1. File System Navigation: Explore directories, move between folders, and understand the structure of the Linux file system.
2. File and Directory Manipulation: Create, copy, move, and delete files and directories with ease.
3. Text Processing: Master essential commands like `nano` to manipulate text files.
4. System Information: Gain insights into your system with commands like `uname`, `df`, and `top`.
Why Linux Matters:
1. Universal Skill:
Linux proficiency is highly sought after in the IT industry, making it an excellent addition to your skillset.
2. Server Administration:
Linux is the go-to choice for web servers, cloud computing, and data centers, making it crucial for server administrators.
3. Development Environment:
Many developers prefer Linux for its flexibility, security, and extensive development tools.
4. Security:
Linux is known for its robust security features, making it a preferred choice for cybersecurity professionals.
Summary:
Linux is your passport to a world of possibilities in the digital realm. It's a skill that empowers you to work efficiently, whether you're a sysadmin, developer, or tech enthusiast. So, let's dive into the lab and unlock the potential of Linux together. Get ready to harness the power of the command line and embark on a journey of discovery!
Exercise Manual
Step 1: Welcome! In this exercise, we will cover basics operations and commands of Linux. Let's get started?
Step 2: The 'whoami' command is used to display the current username of the logged-in user in the terminal. Let's try this and find who is logged in as a current user.
Step 3: The 'pwd' command is used to display the current working directory in the terminal.Let's us this commmand and try to find out what is our curretn working directory
Step 4: Let's check month's calender with the help of 'cal' command which is used to display a calendar for the current month in the terminal.
Step 5: The 'date' command is used to display the current date and time in the terminal.
Step 6: The 'ls' command is used to list the files and directories in the current working directory. When we add the -a option to the ls command, it will display all files and directories, including hidden ones.
Step 7: 'whoami' displays the current username, 'pwd' shows the present working directory, and 'ls -a' lists all files and directories, including hidden ones.
Step 8: When you run the 'clear' command, it will remove all the previous commands, output, and content from the terminal (screen), giving you a clear and empty screen.
Step 9: The 'uname' command display the operating system information.
Step 10: The mkdir command is used to create directories (folders) in the file system. In this example, we are creating two directories named 'test1' and 'test2' in the current working directory.
Step 11: The rmdir command is used to remove empty directories (folders) from the file system. In this example, we are removing the directory named 'test2' from the current working directory.
Step 12: If the folder is not empty then go with rm -r test2(for non-empty directory).
Step 13: The cd command is used to change the current working directory to the specified directory. In this example, we are changing the current working directory to 'test1.'
Step 14: The man command allows you to access the manual pages for various Linux commands, providing detailed information about their usage and options. In this example, we are using man with the ls command.
Step 15: 'cd ..' moves you to the parent directory, while 'cd' (without arguments) takes you to your user's home directory. (Let's move back to user's home diretcory using the command cd)
Step 16: The su command is used to switch to another user account in Linux. It stands for 'Switch User' or 'Super User.'
Step 17: Now, as we have covered the basics of commands now Let's get a dive in file system for linux
Step 18: The touch command is used to create new empty files in Linux. In this example, we are creating three new files named 'file1.txt','file2.txt,' and 'file3.txt.'
Step 19: You can create as many file with anyname of your suggestion with the command(touch <filename> <filename> <filename> ...)
Step 20: The rm command is used to remove or delete files in Linux. In this example, we are removing the file named 'file3.txt' from the file system.
Step 21: The mv command is used to move files or directories from one location to another in Linux. In this example, we are moving the file named 'file2.txt' to the 'test1' directory.
Step 22: You can confirm the above by checking the test1 directory fire the commands like this cd test1 -> ls and then again move back to user's home dorectory cd)
Step 23: The nano command is used to open and edit a text file named 'file1.txt' using the Nano text editor in Linux.
Step 24: Write the content in the file then to save the file press Ctrl+x then y then hit enter
Step 25: The head command is used to display the first few lines of a text file. In this example, we are using head to show the first 5 lines of 'file1.txt'.
Step 26: The tail command is used to display the last few lines of a text file. In this example, we are using tail to show the last 5 lines of 'file1.txt'.
Step 27: The cat command is used to display the contents of a text file named 'file1.txt' in the terminal.
Step 28: The tac command is used to display the contents of a text file named 'file1.txt' in reverse order, showing the last line first and the first line last.
Step 29: The cp command is used to copy files in Linux. In this example, we are copying the file named 'file1.txt' to the 'test1' directory with the new name 'file2.txt'.
Step 30: The mv command is used to move or rename files in Linux. In this example, we are renaming the file 'file1.txt' to 'final.txt.'
Step 31: The sort command is used to sort the lines of a text file in ascending order by default. When you add the -r option to the sort command, it will sort the lines in descending order.
Step 32: The chmod command is used to change the permissions of a file in Linux. In this example, we are using chmod with the value '777' to set full permissions (read, write, and execute) for all users on the file 'final.txt.'
Step 33: More for chmod The 777 represents that all the permissions are given for owner,group and usr repectively. 7 represents all permission ('1' for execution, '2' for write and '4' or read and adding all to get 7)
Step 34: To check for option related to any perticular command check the man page by the command man <commmand name>
Step 35: With the command echo, We can interact with the terminal value and display the content woth the help of terminal and echo
Step 36: You can have many more argumnets with date and cal command as per you usage check the manual page of date and time
Step 37: Congratulations! We have completed the journey through the wondrous basic Linux realm.