0% found this document useful (0 votes)
6 views

Linux Commands

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Linux Commands

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

sudo cat /etc/passwd


- Displays the contents of the `/etc/passwd` file, which contains information about all the user accounts on the
system.
2. sudo useradd -m -s /bin/bash [user]
- Adds a new user, creates a home directory for her (`-m`), and sets her default shell to `/bin/bash`.
3. sudo passwd [user]
- Sets or changes the password for the user.
4. sudo cat /etc/passwd | grep [user]
- Searches the `/etc/passwd` file for any line that contains `user` to confirm the user exists.
5. sudo usermod -d /home/[directory] [user]
- Changes the home directory of the user.
6. sudo userdel -r [user]
- Deletes the user and removes her home directory and files (`-r`).
7. sudo cat /etc/[group]
- Displays the contents of the `/etc/group` file, which shows all the system groups and their members.
8. sudo groupadd [group]
- Creates a new group
9. sudo usermod -aG [group] [user]
- Adds the user to a group without removing her from other groups (`-aG`).
10. sudo groupdel group
- Deletes the group from the system.
11. sudo mkdir /[directory]
- Creates a new directory
12. sudo touch /[directory]/[file]
- Creates an empty file inside the directory.
13. sudo chown [user]:[group] /[directory]/[file]
- Changes the ownership of the file to the user and the group.
14. sudo ls -l /[directory]/[file]
- Lists the file `labfile.txt` in a long format, showing its detailed information like permissions and ownership.
15. sudo chmod 754 /[directory]/[file]
- Changes the file permissions. With `754`, the owner can read, write, and execute the file, the group can read
and execute, and others can only read.

You might also like