Linux/1-Commands: Difference between revisions
< Linux
mNo edit summary |
|||
(63 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== | {| class="wikitable" border="1" | ||
|- | |||
! Command | |||
! Arguments | |||
! Info | |||
! Example | |||
|- | |||
| colspan="4" style="background-color:#ffffff;" | <br> '''Basic''' | |||
|- | |||
| dir | |||
| -Flah | |||
| list folder content | |||
| dir -Flah | |||
|- | |||
| cat | |||
| %file | |||
| show file content | |||
| cat config.txt | |||
|- | |||
| colspan="4" style="background-color:#ffffff;" | <br> '''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 | |||
|- | |||
| colspan="4" style="background-color:#ffffff;" | <br> '''Search''' | |||
|- | |||
| locate | |||
| %file | |||
| locate file | |||
| locate fstab | |||
|- | |||
| updatedb | |||
| | |||
| update locate database | |||
| | |||
|- | |||
| find | |||
| / -n %filename | |||
| search for file | |||
| | |||
|- | |||
| colspan="4" style="background-color:#ffffff;" | <br> '''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 | |||
| | |||
| | |||
| | |||
|- | |||
| colspan="4" style="background-color:#ffffff;" | <br> '''Runlevel''' | |||
|- | |||
| runlevel | |||
| | |||
| | |||
| | |||
|- | |||
| init | |||
| %rlvl | |||
| | |||
| | |||
|- | |||
| halt | |||
| | |||
| | |||
| | |||
|- | |||
| reboot | |||
| | |||
| | |||
| | |||
|- | |||
| shutdown | |||
| -h now | |||
| | |||
| | |||
|- | |||
| colspan="4" style="background-color:#ffffff;" | <br> '''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) | |||
| | |||
|- | |||
| colspan="4" style="background-color:#ffffff;" | <br> '''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 | |||
| | |||
| | |||
| | |||
|- | |||
| 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 | |||
| | |||
| 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 | |||
| | |||
|- | |||
| colspan="4" style="background-color:#ffffff;" | <br> '''Helpers''' | |||
|- | |||
| watch | |||
| -n 5 --differences | |||
| repeat command every n seconds | |||
| | |||
|- | |||
| | |||
| | |||
| | |||
| | |||
|- | |||
| | |||
| | |||
| | |||
| | |||
|} | |||
* | * http://linoxide.com/guide/linux-command-shelf.html | ||
[[Category:Linux/CheatSheet]] | |||
[[Category:Linux]] | |||
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 | |