A Bunch of Little How-Tos
07-Nov-00
Stefan Jeglinski
shell commands
- discover your default paths: echo $PATH
- show color file listings: ls --color
- make aliases: in ~./bashrc, add lines like alias ls='ls --color'
- add a user: useradd [-g name_of_group] name_of_user
- change a user's password: passwd name_of_user
- delete a user: userdel name_of_user
- measure hard disk speed: hdparm -tT /dev/hda
- peruse the kernel boot ring buffer message: dmesg
- peruse all boot messages: more /var/log/boot.log
- endless loop to read the last N runtime messages: tail -f [-n N] /var/log/messages
- set terminal foreground color: setterm -foreground the_color -store
- set terminal background color: setterm -background the_color -store
- check disk usage of all mounted partitions: df
- check inode usage of all mounted partitions: df -i
- report size (in kBytes) of all enclosed directories (recursive): du -k
- report size (in MBytes) of all enclosed directories (non-recursive): du -ms *
rpm commands (§ - package must be installed already)
- install: rpm -i[hv] name_of_rpm.ppc.rpm
- upgrade: rpm -U[hv] name_of_rpm.ppc.rpm
- uninstall: rpm -e name_of_rpm
- get version number: rpm -q name_of_rpm
- get package info: rpm -qi name_of_rpm §
- find out which packages are installed: rpm -qa
- discover package contents: rpm -qpl name_of_rpm.ppc.rpm
- discover package dependencies: rpm -qR name_of_rpm
- find out which rpm a file goes with: rpm -qf name_of_file §
- find out which rpm provides a particular file: rpm -q --whatprovides name_of_file §
- uninstall all packages that start with this-: rpm -qa | grep "^this-" | xargs rpm -e
- uninstall all packages that contain that: rpm -qa | grep "that" | xargs rpm -e
restarting stuff without rebooting
- inetd services:
- edit /etc/inetd.conf
- run killall -HUP inetd or /etc/inetd restart
- libraries:
- add name of library to /etc/ld.so.conf
- run ldconfig
create a text file on a shoestring
- cat > text_file <return>
- <type in the file line by line> <return>
- CNTL-D
get some system and machine info
- print Linux version information: uname -r
- print hardware summary: more /proc/cpuinfo
compress files and directories
- compress a file: gzip a_file (result is a_file.gz)
- decompress a file: gunzip a_file.gz
- archive a directory: tar cf a_directory.tar a_directory (hyphen not necessary)
- extract a directory: tar xf a_directory.tar
- look at the contents of an archive: tar tvf a_directory.tar
- archive and compress a directory: tar czf /dest_path/a_directory.tar.gz /the_path_to/a_directory
- decompress and extract an archive: tar xzf a_directory.tar.gz
-
segment and recombine files
- segment a file into 5 Meg sections named part**: split -b 5m a_file part (result is partaa, partab, etc.)
- resegment those parts into the original file: cat part* > the_original_file
rapierbit