Toolkitly
One moment…
toolkitly

Linux Commands

Bash reference.

65/65
//Files15

List files (long)

$ls -la

List with human sizes

$ls -lh

Change directory

$cd /path/to/dir

Print working directory

$pwd

Create directory (parents)

$mkdir -p path/to/dir

Copy recursive

$cp -r source/ dest/

Move / rename

$mv source dest

Remove recursive

$rm -rf directory

Show file content

$cat file.txt

Follow log file

$tail -f file.log

First N lines

$head -n 20 file.txt

Find by name

$find /path -name "*.txt"

Find by modified time

$find . -mtime -7

Disk usage (dir)

$du -sh *

File info

$stat file.txt
//Processes9

List all processes

$ps aux

Search processes

$ps aux | grep nginx

Interactive monitor

$htop

Kill process

$kill -9 <pid>

Kill by name

$killall processname

Find process by name

$pgrep -f "process name"

Run in background

$command &

Detach and persist

$nohup command &

List background jobs

$jobs
//Network10

Show interfaces

$ip a

Show routes

$ip route show

Listening ports

$ss -tuln

Ping

$ping google.com

HTTP request

$curl -i https://example.com

Download file

$wget https://example.com/file.zip

SSH connect

$ssh user@host

SSH copy key

$ssh-copy-id user@host

SCP upload

$scp file.txt user@host:/path/

Trace route

$traceroute google.com
//Permissions7

Change mode (octal)

$chmod 755 file.txt

Add execute bit

$chmod +x script.sh

Recursive chmod

$chmod -R 644 directory/

Change owner

$chown user:group file.txt

Recursive chown

$chown -R user:group dir/

Run as root

$sudo command

Switch user

$su - username
//Archive7

Create tar.gz

$tar -czf archive.tar.gz directory/

Extract tar.gz

$tar -xzf archive.tar.gz

List tar contents

$tar -tzf archive.tar.gz

Create zip

$zip -r archive.zip directory/

Extract zip

$unzip archive.zip

Gzip file

$gzip file.txt

View gzip without extract

$zcat file.txt.gz
//Text processing9

Search text

$grep -r "pattern" directory/

Grep case-insensitive

$grep -i "pattern" file.txt

Grep invert

$grep -v "pattern" file.txt

Sed replace

$sed -i 's/old/new/g' file.txt

Awk column

$awk -F',' '{print $2}' file.csv

Sort unique

$sort file.txt | uniq

Cut field

$cut -d',' -f1 file.csv

Word / line count

$wc -l file.txt

Diff files

$diff -u file1 file2
//System8

Kernel info

$uname -a

System uptime

$uptime

Disk free

$df -h

Memory usage

$free -h

List mounts

$mount

Environment variables

$env

Set variable

$export NAME=value

History

$history