Jul 31, 2024
ls
, cd
, pwd
, mkdir
, cp
, rm
, mv
, du
, chmod
, chown
, cat
, tail
, head
, less
, nano
, ps
, top
, kill
, bg
, fg
, ifconfig
, ip
, netstat
, ss
, ssh
, scp
, rsync
, tar
, gzip
, find
, grep
ls
ls
ls -l
: Long listing formatls -a
: Show hidden filesls -t
: Sort by modification timels -h
: Human-readable formatls -lath
cd
cd [directory]
cd -
cd ..
cd
pwd
pwd
touch
touch file1 file2
mkdir
mkdir dir1
mkdir -p dir1/dir2/dir3
mkdir -m 777 dir1
cp
cp file1 file2
cp -r dir1 dir2
rm
rm file1
rm -r dir1
rm -rf dir1
mv
mv file1 file2
mv file1 dir1
du
du
du -h
du -sh
chmod
chmod [permissions] file
chmod +x file
chown
chown user:group file
chown user file
chown :group file
cat
cat file
cat file1 file2 > file3
cat file3 >> file1
tail
tail file
tail -n 20 file
tail -f file
head
head file
head -n 20 file
less
and more
less file
, more file
less
: /search_term
nano
and vi
nano
for simple text editing: nano file
vi
for more advanced editing: vi file
i
:wq
:q!
ps
ps
ps aux
top
top
top -u username
top -p PID
kill
kill PID
kill -9 PID
bg
and fg
command &
jobs
fg %job_number
ifconfig
and ip
ifconfig
, ip addr
ip route
ip addr add IP/NETMASK dev INTERFACE
netstat
and ss
netstat -l
, ss -t
ss -lt
ssh
and scp
ssh user@host
scp file user@host:/path
rsync
rsync -av source/ destination/
tar
tar -cvf archive.tar files
tar -xvf archive.tar
tar -czvf archive.tar.gz files
gzip
gzip file
gunzip file.gz
find
find /path -name 'filename'
find /path -size +1M
find /path -mtime -30
grep
grep 'pattern' file
grep -r 'pattern' /path
uname
uname -a
df
df -h
useradd
, usermod
, userdel
useradd username
useradd -m username
useradd -e YYYY-MM-DD username
userdel username
userdel -r username
groupadd
, groupdel
groupadd groupname
groupdel groupname