Welcome to WebmasterWorld Guest from 54.198.185.204

Forum Moderators: travelin cat

Message Too Old, No Replies

Unix commands every Mac webmaster user should know

Some useful tricks for the command line phobics

     
9:37 am on Mar 21, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 15, 2002
posts:710
votes: 0


A friend of mine was asking about whois lookups. Very easy:

Open Terminal (/Applications/Utilities/Terminal) and type:

whois bbc.co.uk

Now for fun let's find out their IP address:

host bbc.co.uk

And let's find out who owns the IP block (using the IP gleaned from the previous command):

whois 212.58.224.131

Inspired by this I thought it would be cool to give our GUI-only friends a few tricks to make their lives easier. What's in your Unix bag of tricks?

2:52 pm on Mar 21, 2006 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 1, 2003
posts:815
votes: 0


What's in your Unix bag of tricks?

As much as I can fit, but for starters...

ftp myname@www.example.com

ftp -h

It might not be as easy as other FTP clients, but it never crashes, it's free, and it's on every Mac OS X machine.

I've found that as a Mac webmaster, the more Unix I know the better.

3:25 pm on Mar 21, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 6, 2003
posts:109
votes: 0


ssh user@host.com -p
Changing my ssh port has helped fight spammers/hackers/DOS etc.
pico index.html
Definetly the fastest/easiest way to edit any file.
3:42 pm on Mar 21, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 30, 2003
posts:728
votes: 0


When installing downloadable software on a remote server (or even locally...):

curl -o filename.ext http://example.com/path/to/filename.ext

Forget this 'download-to-workstation-and-upload-to-server' nonsense!

-b

6:41 pm on Mar 21, 2006 (gmt 0)

Full Member

10+ Year Member

joined:Feb 4, 2004
posts:215
votes: 0


scp /file/on/local/machine /location/on/remote/machine
secure copy is great when I need to move a few files and I know exactly where they are going.
8:34 pm on Mar 21, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 15, 2002
posts:710
votes: 0


Here's a fun one. When you're out of town and missing that special someone, paste this into the Terminal (all on one line):

say -v Agnes "For Pete's sake, are you reading that web master world again? Oh for crying out loud, make yourself useful for once and take out that fricken trash it stinks."

hehe ;)

8:37 pm on Mar 21, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 9, 2004
posts:643
votes: 0


nslookup google.com

traceroute google.com

9:15 pm on Mar 21, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 1, 2004
posts:607
votes: 0


grep -rl "string I want to find" *
11:45 pm on Mar 21, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Dec 9, 2003
posts:3416
votes: 0


whereis php
(and for other binaries)
12:18 am on Mar 22, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


which
awk
cat
sed
ping
ifconfig
man (duh)
ls
dmesg
cp
rm
mkdir
rmdir
cd
find
chmod
chown...

Those were in my console history :)

Oh, my fav is:

emerge (Gentoo)

I'm a Linux man, but it's the same right?

6:23 pm on Mar 23, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 15, 2002
posts:710
votes: 0


Just encountered this: Have a 25+MB file that's a long list, and I needed to strip out the duplicates.

sort original_filemane  uniq > new_filename

uniq only finds duplicates on adjacent lines, hence the need to sort first.

10:44 pm on Mar 23, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 1, 2004
posts:607
votes: 0


I'm a Linux man, but it's the same right?

"Similar but different" would be a better description. AFAIK OS X adopted FreeBSD's userland utilities, so some things are subtly not quite the same (netstat is the only thing that comes to mind right now though).

(Linux on the desktop and webservers, OpenBSD on the firewall and OS X on the laptop = recipe for command-line confusion ;-).

6:47 am on Mar 27, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 9, 2004
posts:169
votes: 0


top -o vsize
5:05 am on Mar 30, 2006 (gmt 0)

New User

10+ Year Member

joined:Dec 16, 2005
posts:27
votes: 0


Heres my list I could not live with out!

Wanna watch whos at your site in real time?

tail -f /var/log/httpd/access_log

wanna see your errors in real time?

tail -f /var/log/httpd/error_log

Having trouble with your mysql tables?

mysqlcheck -u root -p --all-databases --analyze --optimize

Im making a site right now about commands and such related to os x server commands if your interested in the site message me and ill give you the address.