Introduction to Linux OS: Basic Commands & User Guide

Linux is a powerful, open-source operating system widely used for servers, development, and security. This guide introduces essential Linux commands for file management, user administration, permissions, and package handling, giving you hands-on practice to build a strong foundation.

Linux Commands:

  1. Navigate to the home directory, Create a new directory named linux_practice.
  2. Inside linux_practice, create three different files and Verify the files exist.
  3. Check the type of each file and Create a symbolic link to file1.txt.
  4. Check the file type of the symbolic link
  5. Navigate to the linux_practice directory.

ls commands and their output:

  1. List files in long format, List all files, including hidden files.
  2. List files in reverse order, List files recursively.
  3. List files sorted by size.
  4. List files sorted by modification time.
  5. List files with colorized output.

Relative and Absolute Path;

  1. Navigate to the home directory.
  2. Create a new directory named path_practice.
  3. Inside path_practice, create two subdirectories: dir1 and dir2.
  4. Inside dir1, create a file named file1.txt.
  5. Move to dir2 using a relative path.
  6. From dir2, navigate back to dir1 using a relative path.
  7. From any location, access file1.txt using an absolute path.
  8. Copy file1.txt from dir1 to dir2 using an absolute path.
  • Delete the copied file in dir2 using a relative path.
  • Display the current working directory to verify paths.

Print Working Directory;

  1. Navigate to the home directory.
  2. Create a new directory named pwd_practice.
  3. Move into the pwd_practice directory.
  4. Display the current working directory.
  5. Create a subdirectory named subdir1 inside pwd_practice.
  6. Move into subdir1.
  7. Display the current working directory again.
  8. Navigate back to the pwd_practice directory.
  9. Verify your location by displaying the current working directory.
  10. Move to the root directory and display the working directory.

Create Directory;

  1. Create a new directory along with its parent directories if they do not exist.
  2. Create a new directory with specific permissions set during creation.
  3. Create a new directory and display a message confirming its creation.
  4. Display the help message for the mkdir command.
  • Check the version information of the mkdir command.
  • Create a new directory along with its parent directories while displaying verbose output.

Create Empty Files;

  1. Change the access time of a file.
  2. Display detailed statistics of a file.
  3. Change only the access time of a file.
  4. Change only the modification time of a file.
  5. Set a file’s timestamp to a specific date and time.
  • Display the help message for the touch command.
  • Check the version information of the touch command.

Remove Files;

  1. Remove a file with a prompt before deletion.
  2. Forcefully remove a file without confirmation.
  3. Remove an empty directory.
  4. Remove a file while displaying a message confirming its deletion.
  5. Display the help message for the rm command.
  • Check the version information of the rm command.

Copy Files and Directories;

  1. Copy a directory and all its contents to another directory recursively.
  2. Copy a file to another location with a prompt before overwriting.
  3. Copy a file to another location while displaying a message confirming the action.
  4. Display the help message for the cp command.
  • Check the version information of the cp command.

Move Files and Directories;

  1. Move a file with prompt before overwriting:
  2. Move file1.txt to file2.txt, prompting before overwriting if file2.txt exists.
  3. Move a file with verbose output:
  4. Move file1.txt to file2.txt while displaying a message confirming the action.
  5. Display the help message for the mv command.
  • Check the version information of the mv command.

User Commands;

  1. Create a new user interactively
  2. Create a new user non-interactively
  3. Delete a user and Check the list of existing users using getent passwd.
  • Change the password of a particular User
  • Retrieve information about a user using the id command.
  • Switch to another user using the su command.
  • Change the user ID of an existing user
  • Lock the user account to prevent login.
  • Unlock a previously locked user account.
  • Change the login username of an existing user.
  • Change the group ID for an existing user.
  • Change the login shell of a user.
  • Modify the full name of an existing user.
  • Add a comment or description for a user.
  • Change the password for a specific user.

Group Commands;

  1. Create a new group
  2. Create a new group with a specified GID.
  3. Remove a group
  4. List all the existing groups
  5. Add a user to a specified group
  6. Remove a user from a specified group
  7. Check the user and group information for confirmation.

Permissions;

  1. Change the permissions of a file using the chmod command with octal notation (chmod 755 file.txt).
  2. Change the permissions of a file using the chmod command with symbolic notation (chmod u+x file.txt).
  3. Change the group ownership of a file using the chgrp command (chgrp staff file.txt).
  4. Change the owner of a file using the chown command (chown user file.txt).
  5. Change both the owner and group of a file using the chown command (chown user:staff file.txt).
  6. Use the ls -l command to verify the permissions and ownership of files after performing the above actions.

Package Manager;

  1. Install a package (wget) using the apt install command.
  2. Remove a package (wget) using the apt remove command.
  • Update the package list to get the latest available packages using apt update.
  • Upgrade all installed packages to their latest versions using the apt upgrade command. Search for a specific package (curl) using apt search
  • Check if a package (vim) is installed using dpkg -l or apt list –installed.
  • Display detailed information about an installed package (vim) using apt show command. Remove unnecessary packages that were installed as dependencies using apt autoremove.
  • Install a package from a .deb file using the dpkg -i command.  Fix broken dependencies after installing a package with sudo apt –fix-broken install.

For other related tools, set up click here

3.7 3 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x