0% found this document useful (0 votes)
2 views6 pages

Linnux Operating Systems Administration Commands

The document provides a comprehensive guide on various aspects of Operating Systems Administration, covering topics such as file permissions, process management, user account management, Linux networking, software management, and system configuration. It includes numerous command-line instructions for managing files, processes, users, groups, and network settings in a Linux environment. Additionally, it addresses software installation and system administration tasks essential for effective Linux operation.
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)
2 views6 pages

Linnux Operating Systems Administration Commands

The document provides a comprehensive guide on various aspects of Operating Systems Administration, covering topics such as file permissions, process management, user account management, Linux networking, software management, and system configuration. It includes numerous command-line instructions for managing files, processes, users, groups, and network settings in a Linux environment. Additionally, it addresses software installation and system administration tasks essential for effective Linux operation.
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

Operating Systems Administration

1. File Permissions

1. ls -l: List files with details, including permissions.


2. chmod: Change file permissions (e.g., chmod 755 filename).
3. chown: Change file owner and group (e.g., chown user:group filename).
4. chgrp: Change the group ownership of a file (e.g., chgrp groupname filename).
5. umask: Set default permissions for newly created files.
6. getfacl: Get file access control lists.
7. setfacl: Set file access control lists.
8. find . -type f -perm 644: Find files with specific permissions.
9. lsattr: List file attributes on a Linux file system.
10. chattr: Change file attributes on a Linux file system.
11. stat filename: Display file or filesystem status.
12. sudo: Execute a command with superuser privileges (important for changing
permissions).
13. file filename: Determine the type of a file.
14. tar -cvf [Link] folder: Create a tar archive with permissions preserved.
15. tar -xvf [Link]: Extract a tar archive, preserving permissions.
16. rsync -avz: Synchronize files with permissions preserved.
17. cp -p: Copy files and preserve permissions.
18. mv: Move files (permissions remain intact).
19. ln -s: Create symbolic links (permissions of the original file apply).
20. du -h --max-depth=1: Display disk usage, including permissions.

2. Processes

1. ps aux: List all running processes.


2. top: Real-time view of running processes.
3. htop: Interactive process viewer (may need to install).
4. kill PID: Terminate a process by its PID.
5. pkill processname: Kill processes by name.
6. killall processname: Kill all instances of a process by name.
7. bg: Resume a paused job in the background.
8. fg: Bring a background job to the foreground.
9. jobs: List active jobs.
10. nice: Start a process with a modified scheduling priority.
11. renice: Change the priority of an existing process.
12. pstree: View processes in a tree format.
13. strace: Trace system calls and signals.
14. free -m: Display memory usage.
15. vmstat: Report virtual memory statistics.
16. lsof: List open files and the processes that opened them.
17. watch -n 1 'ps aux': Continuously monitor processes.
18. systemctl status: Check the status of a system service.
19. at: Schedule a command to run at a specific time.
20. cron: Schedule recurring tasks.
3. User Account Management

1. adduser username: Add a new user.


2. deluser username: Remove a user.
3. usermod -aG groupname username: Add a user to a group.
4. passwd username: Change a user's password.
5. chage -l username: List user password expiry information.
6. groups username: Show groups a user belongs to.
7. whoami: Display the current logged-in user.
8. id username: Show user ID and group ID.
9. userdel -r username: Remove a user and their home directory.
10. visudo: Edit the sudoers file safely.
11. useradd: Create a new user (more basic than adduser).
12. finger username: Display information about a user.
13. last: Show the last logins of users.
14. w: Show who is logged in and what they are doing.
15. su - username: Switch to another user.
16. net user username: Manage user accounts (in a networked environment).
17. getent passwd: Get user account information from the database.
18. chsh: Change a user's default shell.
19. newgrp groupname: Log in to a new group.
20. passwd -e username: Expire a user's password immediately.

4. Linux Networking

1. ifconfig: Display network interface configuration (may need to install net-tools).


2. ip a: Show network interfaces and their details.
3. ping host: Test connectivity to another host.
4. traceroute host: Trace the route packets take to a host.
5. netstat -tuln: Show listening ports and services.
6. ss -tuln: Another tool to display sockets.
7. nslookup domain: Query DNS information.
8. dig domain: DNS lookup utility.
9. route -n: Display the routing table.
10. ip route: View routing information.
11. nmap: Network exploration tool and security/port scanner.
12. iptables: Configure network packet filtering rules.
13. curl -I url: Fetch HTTP headers from a URL.
14. wget url: Download files from the web.
15. scp source destination: Securely copy files between hosts.
16. sftp user@host: Securely transfer files over SSH.
17. hostname: Show or set the system's hostname.
18. hostnamectl: Control the system hostname.
19. mtr: Network diagnostic tool combining ping and traceroute.
20. iwconfig: Configure wireless network interfaces.

5. Software Management
1. apt update: Update the package list.
2. apt upgrade: Upgrade all installed packages.
3. apt install package: Install a new package.
4. apt remove package: Remove a package.
5. apt purge package: Remove a package and its configuration files.
6. apt search package: Search for a package in the repository.
7. apt show package: Display package information.
8. dpkg -l: List installed packages.
9. dpkg -i [Link]: Install a .deb package.
10. dpkg --remove package: Remove an installed package.
11. apt autoremove: Remove unused packages.
12. snap list: List installed snap packages.
13. snap install package: Install a snap package.
14. snap remove package: Remove a snap package.
15. flatpak install: Install a Flatpak application.
16. flatpak list: List installed Flatpak applications.
17. flatpak remove: Remove a Flatpak application.
18. apt-cache policy package: Show package version information.
19. apt-mark hold package: Prevent a package from being upgraded.
20. apt-mark unhold package: Allow a held package to be upgraded.

6. Installing and Configuring Linux Operating System

1. fdisk -l: List all disk partitions.


2. parted: Manage disk partitions interactively.
3. mkfs.ext4 /dev/sdX: Format a partition with the ext4 file system.
4. mount /dev/sdX /mnt: Mount a filesystem.
5. umount /mnt: Unmount a filesystem.
6. dpkg-reconfigure: Reconfigure installed packages.
7. update-grub: Update GRUB bootloader configuration.
8. grub-install: Install the GRUB bootloader.
9. lsblk: List block devices.
10. blkid: Display block device attributes.
11. chroot: Change the root directory for a command.
12. debootstrap: Install a Debian-based system from scratch.
13. systemctl enable service: Enable a service to start at boot.
14. systemctl disable service: Disable a service from starting at boot.
15. hostnamectl set-hostname newname: Set the system hostname.
16. timedatectl: Control the system time and date settings.
17. localectl: Configure system locale and keyboard layout.
18. networkctl: Manage network configurations.
19. journalctl: View system logs.
20. systemd-analyze: Analyze and debug system startup.

7. Configuring the Linux Operating System

1. systemctl: Manage system services.


2. service servicename start: Start a service.
3. systemctl stop servicename: Stop a service.
4. systemctl restart servicename: Restart a service.
5. systemctl status servicename: Check the status of a service.
6. nano /etc/hosts: Edit the hosts file.
7. nano /etc/fstab: Configure filesystem mounts.
8. systemctl mask servicename: Prevent a service from being started.
9. systemctl unmask servicename: Allow a masked service to start.
10. sysctl: Configure kernel parameters at runtime.
11. update-alternatives: Manage different versions of applications.
12. timedatectl set-time: Set the system time.
13. locale-gen: Generate locale settings.
14. update-locale: Set system-wide locale settings.
15. dpkg-reconfigure locales: Reconfigure locale settings.
16. systemctl get-default: Check the default target (runlevel).
17. systemctl set-default target: Set the default target.
18. hostnamectl set-chassis: Set the chassis type for the system.
19. systemd-resolve: Resolve hostnames to IP addresses.
20. systemd-timesyncd: Manage time synchronization.

8. Administering Group Policy

1. groupadd groupname: Create a new group.


2. groupdel groupname: Delete a group.
3. usermod -aG groupname username: Add a user to a group.
4. gpasswd -a username groupname: Add a user to a group.
5. gpasswd -d username groupname: Remove a user from a group.
6. groups: Display groups a user belongs to.
7. cat /etc/group: View the group file.
8. newgrp groupname: Log in to a new group.
9. chgrp groupname filename: Change group ownership of a file.
10. find . -group groupname: Find files owned by a specific group.
11. sg groupname -c 'command': Run a command with group privileges.
12. getent group: Get group information from the databases.
13. setgid: Set the group ID on execution for files.
14. chown :groupname filename: Change group ownership of a file.
15. usermod -g newgroup username: Change the primary group of a user.
16. id -G username: List all group IDs for a user.
17. groupmod: Modify an existing group.
18. find /path -type d -exec chgrp groupname {} \;: Change group ownership
recursively.
19. lsgroup: List groups (may require additional installation).
20. groups username: List groups for a specific user.

9. Management of User Accounts

1. adduser username: Create a new user account.


2. deluser username: Delete a user account.
3. usermod -aG groupname username: Add user to a group.
4. passwd username: Change the password for a user.
5. chage -l username: Display password expiry information.
6. who: Show who is logged in.
7. last: Display the last login sessions.
8. finger username: Show user information.
9. w: Show who is logged in and what they are doing.
10. id username: Show user and group IDs.
11. userdel -r username: Remove user and their home directory.
12. visudo: Safely edit the sudoers file.
13. newgrp groupname: Join a new group without logging out.
14. getent passwd username: Get user account information.
15. chsh: Change a user's default shell.
16. usermod -g newgroup username: Change the primary group.
17. usermod -l newusername oldusername: Rename a user.
18. passwd -e username: Expire a user's password immediately.
19. usermod -s /bin/bash username: Change a user's shell.
20. sudo -u username command: Run a command as a different user.

Linux File System Commands

1. ls: List directory contents.


2. cd: Change the current directory (e.g., cd /path/to/directory).
3. pwd: Print the current working directory.
4. mkdir directoryname: Create a new directory.
5. rmdir directoryname: Remove an empty directory.
6. rm filename: Remove a file.
7. rm -r directoryname: Recursively remove a directory and its contents.
8. cp source destination: Copy files or directories (e.g., cp [Link]
[Link]).
9. mv source destination: Move or rename files or directories.
10. touch filename: Create an empty file or update the timestamp of an existing file.
11. cat filename: Display the contents of a file.
12. more filename: View the contents of a file one screen at a time.
13. less filename: View the contents of a file with backward and forward navigation.
14. head filename: Display the first few lines of a file.
15. tail filename: Display the last few lines of a file.
16. file filename: Determine the type of a file.
17. df -h: Display disk space usage for file systems in a human-readable format.
18. du -h directoryname: Display disk usage for a directory and its contents.
19. find /path -name filename: Search for files and directories by name.
20. mount: Mount a filesystem (e.g., mount /dev/sdX /mnt).

Linux File System Commands

1. ls: List directory contents.


2. cd: Change the current directory (e.g., cd /path/to/directory).
3. pwd: Print the current working directory.
4. mkdir directoryname: Create a new directory.
5. rmdir directoryname: Remove an empty directory.
6. rm filename: Remove a file.
7. rm -r directoryname: Recursively remove a directory and its contents.
8. cp source destination: Copy files or directories (e.g., cp [Link]
[Link]).
9. mv source destination: Move or rename files or directories.
10. touch filename: Create an empty file or update the timestamp of an existing file.
11. cat filename: Display the contents of a file.
12. more filename: View the contents of a file one screen at a time.
13. less filename: View the contents of a file with backward and forward navigation.
14. head filename: Display the first few lines of a file.
15. tail filename: Display the last few lines of a file.
16. file filename: Determine the type of a file.
17. df -h: Display disk space usage for file systems in a human-readable format.
18. du -h directoryname: Display disk usage for a directory and its contents.
19. find /path -name filename: Search for files and directories by name.
20. mount: Mount a filesystem (e.g., mount /dev/sdX /mnt).

You might also like