Unveiling the Penguin Power: A Beginner's Guide to Linux
What is Linux?
Inspired by Unix, a student from Finland named Linus Torvalds developed the Linux kernel in 1991. Collaboration was possible since it was open-source. Red Hat and other Linux distributions turned it into a server powerhouse by the mid-1990s. Problems persisted even as desktop usage increased with user-friendly interfaces. These days, Linux rules servers fuels the growth of the open-source movement and drives Android smartphones.
Linux File System Hierarchy
Your Linux system's organizational structure is called the Filesystem Hierarchy Standard (FHS), or Linux File System Hierarchy. All software, including hardware applications, is represented as a file under Linux. Files are kept in directories, and each directory has a file with a tree structure. It defines where different types of files and directories are located, ensuring consistency across various Linux distributions.
+--------+
| Root (/)|
+--------+
|
V
+-----------------+
| bin | (Essential commands)
+-----------------+
|
V
+-----------------+
| boot | (Bootloader files)
+-----------------+
|
V
+-----------------+
| dev | (Device files)
+-----------------+
|
V
+-----------------+
| etc | (System configuration)
+-----------------+
|
V
+-----------------+
| home | (User directories)
+-----------------+
|
V
+-----------------+
| lib | (Essential libraries)
+-----------------+
|
V
+-----------------+
| sbin | (System administration tools)
+-----------------+
|
V
+-----------------+
| usr | (Most user programs & utilities)
+-----------------+
|
V
+-----------------+
| var | (Variable data)
+-----------------+
|
V
(Many other directories...)
Please note that this is a simplified representation of the FHS. There are many other directories within the hierarchy, each with its own specific purpose.
Basic Linux Commands
Navigation:
cd
: Change directory. Use this to move between folders. For example,cd Documents
takes you to your Documents folder.pwd
: Print Working Directory. This displays the full path of your current location.ls
: List directory contents. This shows you all the files and folders in the current directory. You can use flags likels -l
for a more detailed listing.
File and Directory Management:
mkdir
: Make directory. This creates a new directory. For example,mkdir newfolder
creates a new folder called "newfolder".touch
: Create an empty file. This creates a new file with no content. For example,touch myfile.txt
creates a new file called "myfile.txt".cp
: Copy files or directories. This allows you to duplicate files or folders. For example,cp file1.txt folder1
copies "file1.txt" to the folder "folder1".mv
: Move or rename files or directories. Use this to change the location or name of a file/folder. For example,mv file1.txt folder1
moves "file1.txt" to "folder1", andmv oldname.txt newname.txt
renames "oldname.txt" to "newname.txt".rm
: Remove files or directories. Use with caution! This permanently deletes files/folders. For example,rm file1.txt
deletes "file1.txt".
Viewing Files:
cat
: Display file contents. This shows you the contents of a text file. For example,cat message.txt
displays the contents of "message.txt".
Getting Information:
man
: Manual page. This provides detailed information about a specific command. For example,man ls
shows the manual page for thels
command.uname
: Print system information. This displays information about your Linux system, such as the kernel version.
Remember: These are just a few basic commands. There are many more powerful commands available in Linux. For a more comprehensive list and detailed explanations, you can refer to online resources or man pages within the system itself.
In Linux, managing users is crucial for system security and organization. Here are some essential commands for user management:
Adding Users:
- useradd: This command is the primary tool for creating new user accounts. You can specify options like username, password (needs separate command), home directory, and more. For example,
useradd username -m -d /home/username
creates a user named "username" with a home directory at "/home/username".
Setting Passwords:
- passwd: This command allows you to set or change a user's password. It prompts you for the current password (if applicable) and then the new password twice. Important: For security reasons, the characters you type while entering your password won't be displayed on the screen.
Modifying User Information:
- usermod: This command is used to modify existing user accounts. You can change various attributes like username, home directory, shell, and more. For example,
usermod -l newusername username
changes the username of "username" to "newusername".
Deleting Users:
- userdel: This command removes a user account from the system. Use with caution! It's recommended to back up the user's home directory before deletion using
userdel -r username
. The-r
flag removes the home directory as well.
Viewing User Information:
id: This command displays information about the current user, including user ID (UID), group ID (GID), and username. You can also use it with a username to get information about another user. For example,
id username
shows details about the user "username".whoami: This is a simpler command that just displays the username of the currently logged-in user.
Additional Tips:
By default, new users created with
useradd
will have a disabled account. You'll need to set a password usingpasswd
to activate the account.The
sudo
command allows users to execute commands with administrative privileges (like root).Always be cautious when modifying user accounts, especially those with administrative privileges.
These commands provide a solid foundation for managing users in your Linux system. Remember, it's important to understand the functionalities and use them responsibly to maintain system security.
Conclusion
Congratulations! You've taken your first steps into the exciting world of Linux. This basic knowledge equips you to navigate the system, manage files and users, and explore its potential. Remember, Linux is a vast and ever-evolving operating system. But with the foundation you've built, you can confidently delve deeper.
Thank You for reading. Please leave a like if you wish to read more such articles. You can connect with me on LinkedIn www.linkedin.com/in/nikhilginnayagari 🤠
Subscribe to my newsletter
Read articles from Nikhil Ginnayagari directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by