Wrigs icon

Common Linux Commands

Wrigs | PRO | 07/03/26 05:28:24 PM UTC (Edited) | 0 ⭐ | 3139 👁️ | Never ⏰ | []
Bash |

3.37 KB

|

None

|

0 👍

/

0 👎

# Add a user
# Basic usage: useradd [options] username
sudo useradd -s /bin/bash -m -c "Fname Lname" -Gwheel <username>
 
# Set a password for new user:
sudo passwd <username>
 
# Set to prompt user to change password at login:
sudo passwd --expire <username>
 
# Add a User to Multiple Groups
sudo groupadd admins
sudo groupadd webadmin
sudo groupadd developers
sudo usermod -a -G admins,webadmin,developers <username>
sudo useradd -G admins,webadmin,developers <username>
 
# Add user to a group
# groupadd - add current user to a group
sudo groupadd <newgroup>
# usermod - add specified user to a group
usermod -a -G <examplegroup> <username>
 
# File and Directory managment
ls         # List directory contents
ls -a      # Do not ignore entries starting with .
ls -h      # List file sizes in human-readable format
ls -l      # Use long listing format
ls -lha    # May combine switches
pwd        # Print working directory
cd         # Change current directory
mkdir      # Create a new directory
rm         # Remove files or directories
rm -rf     # Remove directory and all contents/subfolders
cp         # Copy files and folders
mv         # Move files and folders
 
# File Content Managment
cat        # Concatenate and display file contents
less       # View file contents one page at a time
head       # View the first part of files
tail       # View the last part of files
 
# User and Permissions Managment
sudo       # Execute a command as a superuser
passwd     # Change user password
chmod      # Change the permissions of files and folders
 
# Process Managment
ps         # Report a shapshot of the corrent processes
kill       # Kill a process - need PID (process ID)
 
# System Information
uname     # Display system information, -a for all information
df        # Display file system disk space usage
free      # Display amount of free and used memory in the system
 
# Network Managment
ping      # Test network connectivity
ifconfig  # Configure network interface parameters
hostname -I # Show IP address
ip addr   # Display IP address of NICs
 
# Software updater
systemctl stop packagekit
systemctl disable packagekit
 
# Change Hostname
sudo hostnamectl set-hostname <New_Custom_Name>
 
# Font Information
fc-list     # Manage and view fonts on the system
fc-cache    # Generate font cache files
fc-cache -f # Force a rebuild of all font cache files
fc-cache -r # Erase font cache files and generate new ones
 
# =========================================================
 
## Aliases - put in shell aliases file
alias ls='ls -lah --color=always --group-directories-first'
alias eza='eza -lah --group-directories-first'
alias rm=' rm -I --preserve-root'
alias cp='cp -i'
alias mv='mv -i'
alias mkdir='mkdir -p'
alias ping='ping -c 5'
alias ipext='curl https://ipinfo.io/ip'
alias ipint="ip addr | awk '\$1==\"inet\" && \$3!=\"scope\" {print \$2}' "
 
 
# Package Management - Arch
alias update='sudo pacman -Syu'
 
# Package Management - Fedora/RHEL/Rocky/Alma
alias update='sudo dnf upgrade' # Fedora/RHEL/Rocky/Alma
 
# Package Management - Debian
alias update='sudo apt update && sudo apt upgrade -y'
 
# Package Management - openSUSE
alias update='sudo zypper ref && sudo zypper up'  # - Leap
alias update='sudo zypper ref && sudo zypper dup' # - Slowroll & Tumbleweed
alias install='sudo zypper in'
alias remove='sudo zypper rm -u'
 
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎