Log in User page Discussion History Go to the site toolbox

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

From BluWiki

(Cool Linux Commands)
(Cool Linux Commands)
Line 1: Line 1:
 
==Cool Linux Commands==
 
==Cool Linux Commands==
 +
dmesg
 +
displays detailed hardware info about machine
  
 
  tcpdump 'host 10.0.1.22 and ((port http) or (port smtp))' -v
 
  tcpdump 'host 10.0.1.22 and ((port http) or (port smtp))' -v

Revision as of 05:48, 10 April 2008

Cool Linux Commands

dmesg

displays detailed hardware info about machine

tcpdump 'host 10.0.1.22 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

http://www.linuxproblem.org/art_9.html

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

[1]

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

http://www.linux.com/article.pl?sid=06/08/14/1945249


resume/create a screen:

screen -R

attach to an attached screen:

screen -x

Handling a RAID HD failure

http://gentoo-wiki.com/HOWTO_Gentoo_Install_on_Software_RAID#Misc_RAID_stuff

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

Backups

Sync iPhoto from laptop to media center:

rsync -rt ~/Pictures/iPhoto_Library media@192.168.0.112:~/Pictures/

Sync iPhoto from media center to laptop:

rsync -rt media@192.168.0.112:~/Pictures/iPhoto_Library ~/Pictures/


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

bash tips

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


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

Postgres

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

Mysql

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

User management

http://www.comptechdoc.org/os/linux/commands/linux_cruserman.html


Understanding /proc/meminfo

http://www.redhat.com/advice/tips/meminfo.html

Site Toolbox:

Personal tools
GNU Free Documentation License 1.2

Disclaimers - About BluWiki