Advertisement
Wrigs

Common Linux Commands

Feb 18th, 2024 (edited)
1,309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.15 KB | None | 0 0
  1. # Add a user
  2. # Basic usage: useradd [options] username
  3. sudo useradd -s /bin/bash -m -c "Fname Lname" -Gwheel <username>
  4.  
  5. # Set a password for new user:
  6. sudo passwd <username>
  7.  
  8. # Set to prompt user to change password at login:
  9. sudo passwd --expire <username>
  10.  
  11. # Add a User to Multiple Groups
  12. sudo groupadd admins
  13. sudo groupadd webadmin
  14. sudo groupadd developers
  15. sudo usermod -a -G admins,webadmin,developers <username>
  16. sudo useradd -G admins,webadmin,developers <username>
  17.  
  18. # Add user to a group
  19. # groupadd - add current user to a group
  20. sudo groupadd <newgroup>
  21. # usermod - add specified user to a group
  22. usermod -a -G <examplegroup> <username>
  23.  
  24. # File and Directory managment
  25. ls         # List directory contents
  26. ls -a      # Do not ignore entries starting with .
  27. ls -h      # List file sizes in human-readable format
  28. ls -l      # Use long listing format
  29. ls -lha    # May combine switches
  30. pwd        # Print working directory
  31. cd         # Change current directory
  32. mkdir      # Create a new directory
  33. rm         # Remove files or directories
  34. rm -rf     # Remove directory and all contents/subfolders
  35. cp         # Copy files and folders
  36. mv         # Move files and folders
  37.  
  38. # File Content Managment
  39. cat        # Concatenate and display file contents
  40. less       # View file contents one page at a time
  41. head       # View the first part of files
  42. tail       # View the last part of files
  43.  
  44. # User and Permissions Managment
  45. sudo       # Execute a command as a superuser
  46. passwd     # Change user password
  47. chmod      # Change the permissions of files and folders
  48.  
  49. # Process Managment
  50. ps         # Report a shapshot of the corrent processes
  51. kill       # Kill a process - need PID (process ID)
  52.  
  53. # System Information
  54. uname     # Display system information, -a for all information
  55. df        # Display file system disk space usage
  56. free      # Display amount of free and used memory in the system
  57.  
  58. # Network Managment
  59. ping      # Test network connectivity
  60. ifconfig  # Configure network interface parameters
  61. hostname -I # Show IP address
  62. ip addr   # Display IP address of NICs
  63.  
  64. # Software updater
  65. systemctl stop packagekit
  66. systemctl disable packagekit
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement