Linux/1-Commands: Difference between revisions
< Linux
No edit summary |
mNo edit summary |
||
(17 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 57: | Line 44: | ||
| file editor | | file editor | ||
| nano | | nano | ||
|- | |- | ||
| vi(m) | | vi(m) | ||
Line 63: | Line 49: | ||
| file editor | | file editor | ||
| vi config.txt | | vi config.txt | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''Search''' | ||
|- | |- | ||
| locate | | locate | ||
Line 71: | Line 56: | ||
| locate file | | locate file | ||
| locate fstab | | locate fstab | ||
|- | |- | ||
| updatedb | | updatedb | ||
| | | | ||
| update locate database | | update locate database | ||
| | | | ||
|- | |- | ||
Line 82: | 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 91: | Line 73: | ||
| show kernel version | | show kernel version | ||
| uname -a | | uname -a | ||
|- | |- | ||
| free | | free | ||
Line 97: | Line 78: | ||
| show free memory | | show free memory | ||
| free -m | | free -m | ||
|- | |- | ||
| fdisk | | fdisk | ||
| -l | | -l | ||
| | | | ||
| | | | ||
|- | |- | ||
Line 109: | 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 127: | Line 103: | ||
| show processes | | show processes | ||
| ps -aux | | ps -aux | ||
|- | |- | ||
| top | | top | ||
Line 133: | Line 108: | ||
| show processes with UI | | show processes with UI | ||
| | | | ||
|- | |||
| ss (netstat) | |||
| | | | ||
| | |||
| ss -tulpn | |||
|- | |||
| landscape-sysinfo | |||
| | |||
| | |||
| landscape-sysinfo | |||
|- | |- | ||
| htop | | htop | ||
| | | | ||
| | | (extra package) | ||
| | |||
|- | |||
|tload | |||
| | |||
|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 175: | Line 154: | ||
| | | | ||
| | | | ||
|- | |- | ||
| pwd | | pwd | ||
| | | | ||
| | | | ||
| | | | ||
|- | |- | ||
|colspan=" | | colspan="4" style="background-color:#ffffff;" | <br> '''Runlevel''' | ||
|- | |- | ||
| runlevel | | runlevel | ||
| | | | ||
| | | | ||
Line 193: | Line 169: | ||
| init | | init | ||
| %rlvl | | %rlvl | ||
| | | | ||
| | | | ||
|- | |- | ||
| halt | | halt | ||
| | | | ||
| | | | ||
Line 204: | Line 178: | ||
|- | |- | ||
| reboot | | reboot | ||
| | | | ||
| | | | ||
Line 211: | 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 262: | 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 280: | 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 300: | Line 259: | ||
| | | | ||
| update list of available packages | | update list of available packages | ||
| | | | ||
|- | |- | ||
Line 306: | Line 264: | ||
| | | | ||
| upgrade packages | | upgrade packages | ||
| | | | ||
|- | |- | ||
Line 312: | Line 269: | ||
| | | | ||
| upgrade all packages incl. kernel | | upgrade all packages incl. kernel | ||
| | | | ||
|- | |- | ||
Line 318: | Line 274: | ||
| | | | ||
| package manager with UI | | package manager with UI | ||
| | | | ||
|- | |- | ||
| dpkg -c | | dpkg -c | ||
| | | | ||
| | | | ||
Line 331: | Line 285: | ||
| get list of all installed packages | | get list of all installed packages | ||
| | | | ||
|- | |||
| dpkg -S filename | |||
| | | | ||
| find package, to which the file belongs | |||
| | |||
|- | |- | ||
| /etc/apt/sources.list | | /etc/apt/sources.list | ||
Line 337: | Line 295: | ||
| | | | ||
| | | | ||
|- | |||
| colspan="4" style="background-color:#ffffff;" | <br> '''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 | |||
|| <nowiki>lsof | grep qcow</nowiki> | |||
|- | |- | ||
| smartctl | | smartctl | ||
| | | | ||
| read smart info | | read smart info | ||
| | | | ||
|- | |- | ||
Line 350: | Line 321: | ||
| | | | ||
| set parameters | | 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 | |||
| | | | ||
|- | |- | ||
| colspan="4" style="background-color:#ffffff;" | <br> '''Helpers''' | |||
|- | |||
| watch | |||
| -n 5 --differences | |||
| repeat command every n seconds | |||
| | | | ||
|- | |||
| | | | ||
| | | | ||
Line 365: | 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 | |