Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
56Activity
0 of .
Results for:
No results containing your search query
P. 1
Unix / Linux / BSD Cheat Sheets I

Unix / Linux / BSD Cheat Sheets I

Ratings:

4.84

(37)
|Views: 9,348 |Likes:
Published by embee
Cheat sheets for Unix, Linux & BSD for sys admins & users alike.
Cheat sheets for Unix, Linux & BSD for sys admins & users alike.

More info:

Published by: embee on Mar 23, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

01/22/2014

pdf

text

original

 
UNIX TOOLBOX
ThisdocumentisacollectionofUnix/Linux/BSDcommandsandtaskswhichareusefulforITworkorforadvancedusers.Thisisapracticalguidewithconciseexplanations,howeverthereader is supposed to know what s/he is doing.1.System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.File System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84.Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135.SSH SCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206.VPN with SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237.RSYNC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258.SUDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269.Encrypt Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2710.Encrypt Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2711.SSL Certificates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3012.CVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3113.SVN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3414.Useful Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3615.Install Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4016.Convert Media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4117.Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4318.Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4319.Disk Quota . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4520.Shells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4621.Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4822.Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5023.Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52Unix Toolbox revision 11Thelatestversionofthisdocumentcanbefoundathttp://cb.vu/unixtoolbox.xhtml.Replace.xhtmlonthelinkwith.pdf forthePDFversionandwith.book.pdf forthebookletversion.Ona duplex printer the booklet will create a small book ready to bind.Error reports and comments are most welcome -c@cb.vuColin Barschel.
 
1SYSTEM
# uname -a# Get the kernel version (and BSD version)# cat /etc/SuSE-release# Get SuSE version# cat /etc/debian_version# Get Debian version
Use/etc/
DISTR
-releasewith
DISTR=
lsb(Ubuntu),redhat,gentoo,mandrake,sun(Solaris),andso on.
# uptime# Show how long the system has been running + load# hostname# system's host name# hostname -i# Display the IP address of the host.# man hier# Description of the file system hierarchy# last reboot# Show system reboot history
1.1Hardware Informations
Kernel detected hardware
# dmesg# Detected hardware and boot messages# lsdev# information about installed hardware# dd if=/dev/mem bs=1k skip=768 count=256 2>/dev/null | strings -n 8# Read BIOS
Linux
# cat /proc/cpuinfo# CPU model# cat /proc/meminfo# Hardware memory# grep MemTotal /proc/meminfo# Display the physical memory# watch -n1 'cat /proc/interrupts'# Watch changeable interrupts continuously# free -m# Used and free memory (-m for MB)# cat /proc/devices# Configured devices# lspci -tv# Show PCI devices# lsusb -tv# Show USB devices# lshal# Show a list of all devices with their properties# dmidecode# Show DMI/SMBIOS: hw info from the BIOS
FreeBSD
# sysctl hw.model# CPU model# sysctl hw# Gives a lot of hardware information# sysctl vm# Memory usage# dmesg | grep "real mem"# Hardware memory# sysctl -a | grep mem# Kernel memory settings and info# sysctl dev# Configured devices# pciconf -l -cv# Show PCI devices# usbdevs -v# Show USB devices# atacontrol list# Show ATA devices
1.2Load, statistics and messages
The following commands are useful to find out what is going on on the system.
# top# display and update the top cpu processes# mpstat 1# display processors related statistics# vmstat 2# display virtual memory statistics# iostat 2# display I/O statistics (2 s intervals)# systat -vmstat 1# BSD summary of system statistics (1 s intervals)
— System —
2
 
# systat -tcp 1# BSD tcp connections (try also -ip)# systat -netstat 1# BSD active network connections# systat -ifstat 1# BSD network traffic through active interfaces# systat -iostat 1# BSD CPU and and disk throughput# tail -n 500 /var/log/messages# Last 500 kernel/syslog messages# tail /var/log/warn# System warnings messages see syslog.conf
1.3Users
# id# Show the active user id with login and group# last# Show last logins on the system# who# Show who is logged on the system# groupadd admin# Add group "admin" and user colin (Linux/Solaris)# useradd -c "Colin Barschel" -g admin -m colin# userdel colin# Delete user colin (Linux/Solaris)# adduser joe# FreeBSD add user joe (interactive)# rmuser joe# FreeBSD delete user joe (interactive)# pw groupadd admin# Use pw on FreeBSD# pw groupmod admin -m newmember# Add a new member to a group# pw useradd colin -c "Colin Barschel" -g admin -m -s /bin/tcsh# pw userdel colin; pw groupdel admin
Encryptedpasswordsarestoredin/etc/shadowforLinuxandSolarisand/etc/master.passwdonFreeBSD.Ifthemaster.passwdismodifiedmanually(saytodeleteapassword),run
#pwd_mkdb -p master.passwd
to rebuild the database.Totemporarilypreventloginssystemwide(forallusersbutroot)usenologin.Themessageinnologin will be displayed.
# echo "Sorry no login now" > /etc/nologin# (Linux)# echo "Sorry no login now" > /var/run/nologin# (FreeBSD)
1.4Limits
Someapplicationrequirehigherlimitsonopenfilesandsockets(likeaproxywebserver,database). The default limits are usually too low.
Linux
Per shell/script 
Theshelllimitsaregovernedby
ulimit
.Thestatusischeckedwith
ulimit-a
.Forexampletochange the open files limit from 1024 to 10240 do:
# ulimit -n 10240# This is only valid within the shell
The
ulimit
command can be used in a script to change the limits for the script only.
Per user/process
Login users and applications can be configured in
/etc/security/limits.conf
. For example:
# cat /etc/security/limits.conf* hard nproc 250# Limit user processesasterisk hard nofile 409600# Limit application open files
System wide
Kernel limits are set with sysctl. Permanent limits are set in
/etc/sysctl.conf
.
# sysctl -a# View all system limits# sysctl fs.file-max# View max open files limit# sysctl fs.file-max=102400# Change max open files limit# cat /etc/sysctl.conf
— System —
3

Activity (56)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
marcmueller2 liked this
kiranusa liked this
Winter Xotic liked this
Lamb Lyn D liked this
salem31 liked this
antoajp liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->