Log in User page Discussion History Go to the site toolbox

Difference between revisions of "User:Sam Odio/Linux commands"

From BluWiki

(Important text files)
(Important text files)
Line 133: Line 133:
===Important text files===
===Important config files===
DNS client config:
DNS client config:
Line 140: Line 140:
  /etc/conf.d/net (gentoo)
  /etc/conf.d/net (gentoo)
  /etc/sysconfig/network-scripts/ifcong-eth0 (centos)
  /etc/sysconfig/network-scripts/ifcong-eth0 (centos)
/etc/network/interfaces (debian)

Revision as of 07:12, 18 April 2008

Cool Linux Commands

cat /proc/meminfo
free -m

display memory info


displays detailed hardware info about machine

tcpdump 'host and ((port http) or (port smtp))' -v

display all http / smtp traffic (realtime)

ps aux

display running applications

scp user@host:./source_file ./destination_file

secure SSH copy

postmap addresses

create addresses.db

rsync -rt ./ root@odioworks.com:/var/www/starvingstartups-com/htdocs

copy files from source dir to destination, ignoring files that haven't changed.

diskutil list

list drives on system (find disk name for volumes)

lsof /dev/disk0s3

Find which applications are using a drive (useful for figuring out why you can't umount a volume)

Random Howtos

Automate SSH login w/o passwords


Creating Links

Create a symbolic link of an entire directory of files using the (*) wildcard.

ln -sf <system path of files to link>/* <system path of desired new links directory>

Symbolic linking just one file.

ln -sf <system path of file>/<filename> <system path of desired new link directory>

Symbolic linking a directory.

ln -sf <system path to directory> <system path of the desired new link directory>

Blogger SFTP access

Enable blogger sftp access: Change PasswordAuthentication to yes in /etc/ssh/sshd_config

Search Bash Command Line History


history | grep -i "<search string>"
!<history number>

Reboot mac os x from command line

osascript -e 'tell application "System Events" to restart'

MediaWiki error on installation - max key length is 1024 bytes

If you get the MySQL error upon installation: failed with error code "Specified key was too long; max key length is 1024 bytes".

Drop(delete) database & execute this line:

CREATE DATABASE `<database name here>` DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci;

Then attempt the installation again.

Using Screen


resume/create a screen:

screen -R

attach to an attached screen:

screen -x

Handling a RAID HD failure


Once the failed drive is ready to be added back into the array, do so w/ the following command:

mdadm /dev/md1 -a /dev/sdc2

More information on how to replace a failed drive: http://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array


Sync iPhoto from laptop to media center:

rsync -rt ~/Pictures/iPhoto_Library media@

Sync iPhoto from media center to laptop:

rsync -rt media@ ~/Pictures/

Rdiff backups? http://liquidweather.net/howto/index.php?id=56

bash tips

http://www.deadman.org/bash.html $!:p

end of previous command: !$

common commands: http://cs.clark.edu/~clug/commands.htm

man readline
ctrl+w: kill line
ctrl+a: beginning of line
ctrl+e: end of line


Stop postgres: sudo -u postgres pg_ctl stop -D /sw/var/postgresql-8.0/data


Start mysql: /sw/share/mysql/mysql.server start

User management


Understanding /proc/meminfo


Important config files

DNS client config:


Ethernet config:

/etc/conf.d/net (gentoo)
/etc/sysconfig/network-scripts/ifcong-eth0 (centos)
/etc/network/interfaces (debian)

Site Toolbox:

Personal tools
GNU Free Documentation License 1.2

Disclaimers - About BluWiki