Skip to content

Instantly share code, notes, and snippets.

@CallMarl
Last active April 16, 2020 14:23
Show Gist options
  • Save CallMarl/ac191e40eec4865560aa7584294a6143 to your computer and use it in GitHub Desktop.
Save CallMarl/ac191e40eec4865560aa7584294a6143 to your computer and use it in GitHub Desktop.
Linux usual command (Debian)
# Check for update
apt-get update
# Apply update
apt-get upgrade -y
# Install package
apt-get install package name
# List installed package
dpkg -l
# Display the command path
which cmd
# Display more revelant information about the commande location
whereis cmd
# Create user only
adduser
# Remove user only
deluser
# Create user and create home directory
useradd user_name
# Remove user with it home directory
userdel user_name
# Add user in specific groupe
adduser user_name sudo
# Kill user session
pkill -9 -u user_name
# Remove user from specific groupe
deluser user_name groupe_name
# Remove groupe
delgroup groupe_name
# Display groupe of the user
groups user_name
# Display id of user
id user_name
# Set the default user shell (Make sur the shell is installed)
usermod -s /bin/bash user_name
# Set the default user home directory
usermod -d /path/to/home user_name
# display /etc/passwd informations and more... (ldap)
cat /etc/passwd
getent passwd
# display /etc/group informations and more... (ldap)
cat /etc/group
getent group
# display /etc/shadow informations and more... (ldap)
cat /etc/shadow
getent shadow
# change the current user password
passwd
# change specific user password
passwd user_name
# Install utils
apt-get install \
tree \
tig \
dos2unix
# Install c function man page
apt-get install \
manpages-dev \
manpages-posix-dev
# Restart
reboot -h 0
# Show service status
service --status-all
# Start service
service service_name start
# Stop service
service service_name stop
# Restart service
service service_name restart
# Display partition
fdisk -l
# Display service state
service service_name status
# Follow logs
tail -f /var/log/log_file
# Display the current folder size
du -sh
# Display folder size
du -h ./
# Display volume
df -h
## Transforme CRLF file ending by LF
dos2unix file_name
# Transforme CRLF file ending by LF for all directory
find . -type f -print0 | xargs -0 dos2unix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment