Linux/1-Commands: Difference between revisions
< Linux
mNo edit summary |
mNo edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
! Info | ! Info | ||
! Example | ! Example | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''Basic''' | ||
|- | |- | ||
| dir | | dir | ||
Line 13: | Line 12: | ||
| list folder content | | list folder content | ||
| dir -Flah | | dir -Flah | ||
|- | |- | ||
| cat | | cat | ||
Line 19: | Line 17: | ||
| show file content | | show file content | ||
| cat config.txt | | cat config.txt | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''Files''' | ||
|- | |- | ||
| mkdir | | mkdir | ||
Line 27: | Line 24: | ||
| create dir | | create dir | ||
| mkdir /var/test | | mkdir /var/test | ||
|- | |- | ||
| rm | | rm | ||
Line 33: | Line 29: | ||
| remove file/dir | | remove file/dir | ||
| rm autoexec.bat | | rm autoexec.bat | ||
|- | |- | ||
| cp | | cp | ||
| %from %to | | %from %to | ||
| copy | | copy | ||
| | | | ||
|- | |- | ||
Line 44: | Line 38: | ||
| %from %to | | %from %to | ||
| move | | move | ||
| | | | ||
|- | |- | ||
Line 51: | Line 44: | ||
| file editor | | file editor | ||
| nano | | nano | ||
|- | |- | ||
| vi(m) | | vi(m) | ||
Line 57: | Line 49: | ||
| file editor | | file editor | ||
| vi config.txt | | vi config.txt | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''Search''' | ||
|- | |- | ||
| locate | | locate | ||
Line 65: | Line 56: | ||
| locate file | | locate file | ||
| locate fstab | | locate fstab | ||
|- | |- | ||
| updatedb | | updatedb | ||
| | | | ||
| update locate database | | update locate database | ||
| | | | ||
|- | |- | ||
Line 76: | Line 65: | ||
| / -n %filename | | / -n %filename | ||
| search for file | | search for file | ||
| | | | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''System info''' | ||
|- | |- | ||
| uname | | uname | ||
Line 85: | Line 73: | ||
| show kernel version | | show kernel version | ||
| uname -a | | uname -a | ||
|- | |- | ||
| free | | free | ||
Line 91: | Line 78: | ||
| show free memory | | show free memory | ||
| free -m | | free -m | ||
|- | |- | ||
| fdisk | | fdisk | ||
| -l | | -l | ||
| | | | ||
| | | | ||
|- | |- | ||
Line 103: | Line 88: | ||
| show harddisk usage | | show harddisk usage | ||
| df -Th | | df -Th | ||
|- | |- | ||
| du | | du | ||
| | | | ||
| | | | ||
| | | | ||
|- | |- | ||
| ifconfig | | ip a (ifconfig) | ||
| | | | ||
| show network settings | | show network settings | ||
| | | | ||
|- | |- | ||
Line 121: | Line 103: | ||
| show processes | | show processes | ||
| ps -aux | | ps -aux | ||
|- | |- | ||
| top | | top | ||
| | | | ||
| show processes with UI | | show processes with UI | ||
| | | | ||
|- | |- | ||
| netstat | | ss (netstat) | ||
| | | | ||
| | | | ||
| | | ss -tulpn | ||
|- | |- | ||
| landscape-sysinfo | | landscape-sysinfo | ||
Line 139: | Line 118: | ||
| | | | ||
| landscape-sysinfo | | landscape-sysinfo | ||
|- | |- | ||
| htop | | htop | ||
| | | | ||
| | | (extra package) | ||
| | | | ||
|- | |- | ||
|tload | |tload | ||
| | | | ||
|show cpu graph | |show cpu graph | ||
| | | | ||
|- | |- | ||
| iotop | | iotop | ||
| | | | ||
| | | (extra package) | ||
| | | | ||
|- | |- | ||
| iftop | | iftop | ||
| | | | ||
| | | (extra package) | ||
| | | | ||
|- | |- | ||
| virt-top | | virt-top | ||
| | | | ||
| | |(extra package) | ||
| | | | ||
|- | |- | ||
| vnstat | | vnstat | ||
| | | | ||
| show network interface statistics | | show network interface statistics | ||
(extra package) | |||
| | | | ||
|- | |- | ||
| who, w | | who, w | ||
Line 181: | Line 154: | ||
| | | | ||
| | | | ||
|- | |- | ||
| pwd | | pwd | ||
| | | | ||
| | | | ||
| | | | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''Runlevel''' | ||
|- | |- | ||
| runlevel | | runlevel | ||
| | | | ||
| | | | ||
Line 199: | Line 169: | ||
| init | | init | ||
| %rlvl | | %rlvl | ||
| | | | ||
| | | | ||
|- | |- | ||
| halt | | halt | ||
| | | | ||
| | | | ||
Line 210: | Line 178: | ||
|- | |- | ||
| reboot | | reboot | ||
| | | | ||
| | | | ||
Line 217: | Line 184: | ||
| shutdown | | shutdown | ||
| -h now | | -h now | ||
| | | | ||
| | | | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''Network''' | ||
|- | |- | ||
| wget | | wget | ||
| | | | ||
| download files | | download files | ||
| | | | ||
|- | |- | ||
| ntpdate | | ntpdate | ||
| | | | ||
|(extra package) | |||
| | | | ||
|- | |- | ||
| dig | | dig | ||
| | | | ||
| get dns info | | get dns info | ||
| | | | ||
|- | |- | ||
| whois | | whois | ||
| | | | ||
| | | (extra package) | ||
| | | | ||
|- | |- | ||
| nslookup | | nslookup | ||
| | | | ||
| get dns info | | get dns info | ||
| | | | ||
|- | |- | ||
| finger | | finger | ||
| | | | ||
| | | (extra package) | ||
| | | | ||
|- | |- | ||
| route | | route | ||
| -n | | -n | ||
| show active routes | | show active routes | ||
| | | | ||
|- | |- | ||
Line 268: | Line 227: | ||
| | | | ||
| show network route to target address | | show network route to target address | ||
| | | | ||
|- | |- | ||
| netstat | | ss (netstat) | ||
| -tulpn | | -tulpn | ||
| show open ports | | show open ports | ||
| | | ss -tulpn (t=tcp, u=udp, l=listening, p=process, n=numeric) | ||
|- | |- | ||
| iwconfig | | iwconfig | ||
| | | | ||
| show wifi settings | | show wifi settings | ||
| | | | ||
|- | |- | ||
Line 286: | Line 242: | ||
| | | | ||
| scan for wifi networks | | scan for wifi networks | ||
| | | | ||
|- | |- | ||
| nethogs | | nethogs | ||
| | | | ||
| | |(extra package) | ||
| | | | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''Apt''' | ||
|- | |- | ||
| apt install | | apt install | ||
| <package> (-s = simulation) | | <package> (-s = simulation) | ||
| install package | | install package | ||
| | | | ||
|- | |- | ||
Line 306: | Line 259: | ||
| | | | ||
| update list of available packages | | update list of available packages | ||
| | | | ||
|- | |- | ||
Line 312: | Line 264: | ||
| | | | ||
| upgrade packages | | upgrade packages | ||
| | | | ||
|- | |- | ||
Line 318: | Line 269: | ||
| | | | ||
| upgrade all packages incl. kernel | | upgrade all packages incl. kernel | ||
| | | | ||
|- | |- | ||
Line 324: | Line 274: | ||
| | | | ||
| package manager with UI | | package manager with UI | ||
| | | | ||
|- | |- | ||
| dpkg -c | | dpkg -c | ||
| | | | ||
| | | | ||
Line 337: | Line 285: | ||
| get list of all installed packages | | get list of all installed packages | ||
| | | | ||
|- | |- | ||
| dpkg -S filename | | dpkg -S filename | ||
Line 343: | Line 290: | ||
| find package, to which the file belongs | | find package, to which the file belongs | ||
| | | | ||
|- | |- | ||
| /etc/apt/sources.list | | /etc/apt/sources.list | ||
| | | | ||
| | | | ||
| | | | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''HDD & Filesystem''' | ||
|- | |- | ||
| dd | | dd | ||
Line 357: | Line 302: | ||
| low level copy | | low level copy | ||
| dd if=/dev/sda2 of=/dev/sdb2 | | dd if=/dev/sda2 of=/dev/sdb2 | ||
|- | |||
|dd | |||
| | | | ||
|wipe drive | |||
|dd if=/dev/urandom of=/dev/sdX bs=4096 status=progress | |||
|- | |- | ||
| lsof | | lsof | ||
| | | | ||
| show open files | | show open files | ||
|| lsof | grep qcow | || <nowiki>lsof | grep qcow</nowiki> | ||
|- | |- | ||
| smartctl | | smartctl | ||
| | | | ||
| read smart info | | read smart info | ||
| | | | ||
|- | |- | ||
Line 374: | Line 321: | ||
| | | | ||
| set parameters | | set parameters | ||
| | | | ||
|- | |- | ||
| blkid | | blkid | ||
| | | | ||
| show block devices UUID | | show block devices UUID | ||
| | | | ||
|- | |- | ||
Line 386: | Line 331: | ||
| -w -r -l -a -v -t /dev/sdc1 | | -w -r -l -a -v -t /dev/sdc1 | ||
| scan fat partition | | scan fat partition | ||
| | | | ||
|- | |- | ||
Line 392: | Line 336: | ||
| -v -f -c /dev/sda1 | | -v -f -c /dev/sda1 | ||
| scan ext4 partition | | scan ext4 partition | ||
| | | | ||
|- | |- | ||
Line 398: | Line 341: | ||
| -v -n1 -z /dev/sdx | | -v -n1 -z /dev/sdx | ||
|wipe hard drive | |wipe hard drive | ||
| | | | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''Helpers''' | ||
|- | |- | ||
| watch | | watch | ||
| -n 5 --differences | | -n 5 --differences | ||
| repeat command every n seconds | | repeat command every n seconds | ||
| | | | ||
|- | |- | ||
| | | | ||
| | | | ||
Line 415: | Line 355: | ||
| | | | ||
|- | |- | ||
| | | | ||
| | | |
Latest revision as of 11:04, 19 October 2024
Command | Arguments | Info | Example |
---|---|---|---|
Basic | |||
dir | -Flah | list folder content | dir -Flah |
cat | %file | show file content | cat config.txt |
Files | |||
mkdir | %dir | create dir | mkdir /var/test |
rm | %file | remove file/dir | rm autoexec.bat |
cp | %from %to | copy | |
mv | %from %to | move | |
nano | (%file) | file editor | nano |
vi(m) | %file | file editor | vi config.txt |
Search | |||
locate | %file | locate file | locate fstab |
updatedb | update locate database | ||
find | / -n %filename | search for file | |
System info | |||
uname | -a | show kernel version | uname -a |
free | -m | show free memory | free -m |
fdisk | -l | ||
df | -Th | show harddisk usage | df -Th |
du | |||
ip a (ifconfig) | show network settings | ||
ps | -aux | show processes | ps -aux |
top | show processes with UI | ||
ss (netstat) | ss -tulpn | ||
landscape-sysinfo | landscape-sysinfo | ||
htop | (extra package) | ||
tload | show cpu graph | ||
iotop | (extra package) | ||
iftop | (extra package) | ||
virt-top | (extra package) | ||
vnstat | show network interface statistics
(extra package) |
||
who, w | |||
pwd | |||
Runlevel | |||
runlevel | |||
init | %rlvl | ||
halt | |||
reboot | |||
shutdown | -h now | ||
Network | |||
wget | download files | ||
ntpdate | (extra package) | ||
dig | get dns info | ||
whois | (extra package) | ||
nslookup | get dns info | ||
finger | (extra package) | ||
route | -n | show active routes | |
traceroute | show network route to target address | ||
ss (netstat) | -tulpn | show open ports | ss -tulpn (t=tcp, u=udp, l=listening, p=process, n=numeric) |
iwconfig | show wifi settings | ||
iwlist scan | scan for wifi networks | ||
nethogs | (extra package) | ||
Apt | |||
apt install | <package> (-s = simulation) | install package | |
apt update | update list of available packages | ||
apt upgrade | upgrade packages | ||
apt dist-upgrade | upgrade all packages incl. kernel | ||
aptitude | package manager with UI | ||
dpkg -c | |||
dpkg --get-selections | get list of all installed packages | ||
dpkg -S filename | find package, to which the file belongs | ||
/etc/apt/sources.list | |||
HDD & Filesystem | |||
dd | if=%in of=%out | low level copy | dd if=/dev/sda2 of=/dev/sdb2 |
dd | wipe drive | dd if=/dev/urandom of=/dev/sdX bs=4096 status=progress | |
lsof | show open files | lsof | grep qcow | |
smartctl | read smart info | ||
hdparm | set parameters | ||
blkid | show block devices UUID | ||
dosfsck | -w -r -l -a -v -t /dev/sdc1 | scan fat partition | |
fsck.ext4 | -v -f -c /dev/sda1 | scan ext4 partition | |
shred | -v -n1 -z /dev/sdx | wipe hard drive | |
Helpers | |||
watch | -n 5 --differences | repeat command every n seconds | |