Skip to content


On this page

Linux Common Commands

View current system info

lsb_release -a


Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

View all users

cat /etc/passwd | grep -v nologin|grep -v halt|grep -v shutdown|awk -F":" '{ print $1"|"$3"|"$4 }'|more

Get Publish IP

hostname -I

Change user group

usermod -g groupname username

Get user group

id -g -n

Remove apt ppa

sudo add-apt-repository --remove ppa:qbittorrent-team/qbittorrent-stable

Get current shell

echo "$SHELL"

Get current cpu arch



dpkg --print-architecture

Unzip tar.gz

tar -xf x.tar.gz

See also here

Tar to specific directory

tar -xf x.tar.gz -C ./xxx

Stdout to File

command &> file


command >| file.txt 2>&1

Download/Upload file by SSH SCP

Download to local:

scp root@ip:/path ~/Downloads

Remove node_modules

find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +

Remove target

find . -name 'target' -type d -prune -exec rm -rf '{}' +

Find and replace string

sed -i 's/old-text/new-text/g' input.txt
ln -s source_file target_file

Create User

useradd -m USERNAME

Note: with home directory

Get all shells

cat /etc/shells

Last n lines in file

tail -3 file.txt

Linux find a biggest directory in ./

sudo du -a ./ 2>/dev/null | sort -n -r | head -n 20

Linux find a biggest file in ./

find ./ -type f -printf '%s %p\n' | sort -nr | head -10
Edit this page
Last updated on 12/6/2021