Useful Commands
From ArchWiki
Contents |
Introduction
This page was randomly added to be a collection of useful shell commands (typed into a terminal) (like find /dir | grep word | wc) that everyone, Arch users, both new and experienced, can refer to.
Additions welcome! Variations are fine too, just as long as they are not TOO slight.
--Evanlec 12 December 2007
Format
For adding commands lets try and use a standard format:
command [flags] /path/to/target <parameter> : shall indicate a parameter to specify in the command (without the <>'s)
Please include a brief description of what the command does as well :)
Follow the format I've started here.
Find Files
- Search for a string and print matching file(s)
find /path | grep <word> | wc ; list files (one per line) containing <word>
- search stuff
find /some/directoy -type (d = dir f = file) -iname "something*" find / -type f -iname "opera*
Filesystem
- Mount ISO image file:
mount -o loop -t iso9660 <image.iso> /mount/point
- Mount read-only FS as rw
mount -o remount,rw /target
- updatedb
updatedb #followed by slocate <word> to find a file
- Show file sizes
du -h --max-depth=1 | sort -n #shows size of files cumulative in current directory
- List files by date
ls -larth #shows all files +dir with newest at bottom
- Show Disks
df -h
Xorg
- Reconfigure xorg.conf
Xorg -configure
- Note: xorgconfig does same, use lspci to find you vidcard, and pacman -S to install the xf86-video-intel(or ati or what have you) driver for your vidcard
System Monitoring
- Show actual memory usage (without cache)
thing=( $(free -m | grep Mem) ); yep=$((thing[2]-thing[6])) ; indeed=$((yep*100/thing[1])) ; echo "Memory Usage: ${yep} MB / ${thing[1]} MB - ${indeed}%"
- Find the pid of a program on execution
$ pidof 'program_on_execution'
- Kill all pid that match with the pattern
$ pkill -f 'pattern_of_program'
More Resources
- Bash
- Bash Guide]
- LinuxCommand.org : good for commandline beginners.
- Linux bash command listing : a-z list of (many) commands.