Friday, June 1, 2012

Unix, Linux, and BSD Command Line Cross-Reference

New Release
Unix, Linux, and BSD systems share a number of similarities; they also have many distinct differences. This is especially true when working in the command line environment. It’s easy to get frustrated, confused, and possibly wreak havoc as you try to transition between the various types of Unix-like systems.

This guide is designed to highlight the differences between Unix, Linux, and BSD on the command line. It covers the most popular Unix-like platforms in use today. Operating systems covered in the book include AIX, Solaris, HP-UX, FreeBSD, OpenBSD, NetBSD, Mac OS X, RedHat/Fedora/CentOS, Debian/Ubuntu, Gentoo, and openSUSE.


 

Thursday, May 31, 2012

Introduction to Vi and Vim

Vi and Vim are modal editors. This is very different than most you are probably familiar with. The Vi and Vim editors have two basic modes of operation:

- Command mode
- Editing mode

Pressing Esc on the keyboard activates command mode. When in command mode, command keys can be used to activate specific editing functions. The following table lists the most common commands for vi and vim.

Tuesday, May 22, 2012

ATTN Kindle Readers: Free Update available

There is a free update available to Introduction to the Command Line Kindle version. This update resolves a problem with the table of contents. You can download the update from the Manage Your Kindle section of Amazon.com.

Thanks for reading.

Monday, April 16, 2012

Now Available: Introduction to the Command Line (Second Edition)

Available now at Amazon.com for purchase today. 

Introduction to the Command Line is a visual guide that teaches the most important Unix and Linux shell commands in a simple and straight forward manner. Command line programs covered in this book are demonstrated with typical usage to aid in the learning process and help you master the command line quickly and easily. 

Covers popular Unix, Linux, and BSD systems.

The 2nd edition features more commands, better descriptions, and expanded examples.

Paperback (270 pages) $22.95 (currently on sale for $15.98)
Kindle eBook $3.99

Wednesday, January 11, 2012

Free eBook: Introduction to the Command Line

Introduction to the Command Line is now part of the Kindle Lending Program. This allows Amazon Prime Subscribers to download The Fat Free Guide to Unix and Linux Commands for FREE!


Download for FREE with your Amazon Prime account!

The print version is still on sale for $22.95 $15.98 at Amazon.com.

PS. You can also get my other book The Nmap Cookbook for free on Amazon Prime in Kindle format.

Tuesday, August 4, 2009

Unix, Linux, and BSD: Command Line Cheat Sheet

The following command line cheat sheet for Unix, Linux, and BSD systems is from my new book Introduction to the Command Line (available now a Amazon.com).

Help Commands

man - Online manual
whatis - Displays manual descriptions

File and Directory Commands

ls - Lists directory contents
pwd - Prints the current directory
cd - Change directories
mv - Move files
cp - Copy files
rm - Delete files
mkdir - Create directories
rmdir - Remove directories
find - Search for files (slow)
locate - Search for files (faster)
whereis - Display binary file location
which - Display binary file location
file - Display file type
size - Display file size
stat - Display file statistics
fuser - Identify open files
touch - Update file timestamps
lsof - List open files
cksum - Calculate checksum
md5sum - Calculate md5sum
ln - Create a link
alias - Display/edit command aliases
gzip - Compress files
gunzip - Uncompress files
shred - Securely delete files
head - Display the head of a file
tail - Display the tail of a file
tee - Display and redirect output
sort - Sort input files/streams
grep - Display matching results
tree - Display directory tree
more - Display files one page at a time
less - Display files one page at a time
wc - Count words/lines/letters
cat - Display files
zcat - Display compressed files
diff - Show differences between files
strings - Display printable characters
sed - Text editing utility
awk - Text processing utility
dos2unix - Convert DOS files to Unix
unix2dos - Convert Unix files to DOS

Editors

nano - Simple text editor
vi - Advanced text editor
emacs - Ultimate text editor

Other Utilities

clear - Clear terminal screen
date - Display the date
cal - Display a calendar
watch - Monitor a command
env - Display environment variables
history - Display command history
logout - Logout of the shell
exit - Exit the shell

Users and Groups

su - Switch user
sudo - Run a program as another user
id - Display user identity
ulimit - Display user limits
who - Display who is logged in
w - Display what users are doing
users - Display active user accounts
last - Display last user logins
lastlog - Display all user’s last login
wall - Send a message to all users
whoami - Display current user id
finger - Display information about a user
chown - Change file/directory ownership
chgrp - Change file/directory group
chmod - Change file/directory permissions
umask - Display or set umask settings
passwd - Set/change password
useradd - Create user accounts
userdel - Delete user accounts
usermod - Modify user accounts
groupadd - Create group accounts
groupdel - Delete group accounts
groupmod - Modify group accounts

Process Control

ps - Display running processes
pgrep - Search for running processes
pidof - Search for PID by name
pstree - Displays process in tree view
kill - Terminate a process by PID
killall - Terminal a process by name
nice - Run a program with a modified priority
renice - Adjust a program's priority
nohup - Run a program immune to hang-ups
& - Run a program in the background
bg - Move a job to the background
jobs - Display running jobs
fg - Move a job to the foreground

Startup and Shutdown

shutdown - Shutdown the computer
poweroff - Poweroff the computer
halt - Halt the computer
runlevel - Display the current runlevel
telinit - Change runlevel
service - Stop and stop services
sysv-rc-conf - Runlevel configuration editor
update-rc.d - Debian runlevel editor
chkconfig - Red Hat runlevel editor
rc-update - Gentoo runlevel editor
rc-status - Gentoo service monitor

Networking Commands

hostname - Display the system hostname
domainname - Display the system domain
ifconfig - Manage network interfaces
ifup - Start network interfaces
ifdown - Stop network interfaces
iwconfig - Manage wireless interfaces
iwlist - Display wireless information
ethtool - Display network card info
arp - Display the ARP cache
ping - Send ICMP echo requests
traceroute - Trace network paths
tracepath - Trace network paths
nslookup - Query DNS servers
dig - Query DNS servers
host - Query DNS servers
whois - Query the whois database
dhclient - Linux DHCP client
netstat - Display network status
route - Manage network routes
tcpdump - Capture network packets
nmap - Scan remote computers
wavemon - Monitor wireless connections
smbtree - Display SMB servers/shares
nmblookup - Look up NetBIOS information
mount - Mount file systems
showmount - Show mounted file systems
umount - Unmount file systems
ssh - SSH client
telnet - Telnet client
ftp - FTP client
ncftp - Scriptable FTP client
mail - Email client
rsync - Rsync client

Hardware Commands

lspci - List PCI devices
pcidump - List PCI devices
lsusb - List USB devices
lshw - List hardware devices
lspcmcia - List PCMCIA devices
lshal - Display all system hardware
hdparm - Configure hard drives
eject - Eject removable media

Scheduling


batch - Run processes when the CPU is free
at - Run processes at a specific time
atq - Display the at queue
atrm - Remove jobs from the at queue
crontab - Display/edit cron jobs

File System Commands

fdisk - Partition editor
parted - Partition editor
mkfs - Create file systems
fsck - Check file systems
mkswap - Create swap space
swapon - Activate swap space
swapoff - Deactivate swap space
sync - Flush disk cache

Backup Commands

tar - Archive utility
dd - File copy utility
dump - Incremental backup utility
restore - Restore dump backups
mt - Tape device utility
cpio - Archive utility

Monitoring Commands

top - Performance monitor
mpstat - Performance monitor
vmstat - Virtual memory monitor
iostat - I/O performance monitor
nfsstat - NFS performance monitor
free - Display memory usage
df - Display disk usage
du - Display disk usage
uname - Display system information
uptime - Display system uptime
lsmod - List kernel modules
modinfo - Display module information
dmesg - Display kernel messages
strace - System trace debugger
ltrace -Library trace debugger
ipcs - IPC monitor
sysctl - Configure kernel parameters

Printing Commands

lp - Print files
lpstat - Display printer status
lpq - Display print queue
lprm - Remove print jobs
cancel - Cancel print jobs
enable - Enable a printer
disable - Disable a printer

Software Commands

dpkg - Debian package manager
apt-get - Debian package utility
rpm - Red Hat package manager
yum - Red Hat package utility
emerge - Gentoo package utility
pkg_add - BSD installation utility
pkg_delete - BSD uninstallation utility
make - Compile software from source

Monday, August 3, 2009

Bash Shell Shortcut Keys

The following BASH shell cheat sheet is from my new book Introduction to the Command Line (available now a Amazon.com).

CTRL + C

Terminate current program

CTRL + Z
Suspend current program

CTRL + D
Exits the shell

Tab
Command/file auto completion

Home
Go to the beginning of the command line

End
Go to the end of the command line

CTRL + L
Clears the screen

Backspace
Deletes text behind the cursor

ATL + Backspace
Delete whole word backwards

Delete
Deletes text in front of the cursor

CTRL + R
Search command history

Up Arrow
Cycle backwards through command history

Down Arrow
Cycle forward through command history

Left Arrow
Move the cursor back one character

Right Arrow
Move the cursor forward one character

ALT + B
Move the cursor back one word

ALT + F
Move the cursor forward one word

CTRL + U
Cut all text before the cursor

CTRL + K
Cut all text after the cursor

ALT + D
Cut the currently selected word

CTRL + Y
Paste previously cut text

CTRL + _ (Underscore)
Undo changes typed on the command line

CTRL + T
Transpose previous 2 characters on the command line

ALT + T
Transpose previous 2 words on the command line

ATL + L
Convert word to lowercase

ATL + U
Convert word to uppercase