Login
Forgot Password?

OR

Login with Google Login with Twitter Login with Facebook
  • Join
  • Profiles
  • Groups
  • SuicideGirls
  • Photos
  • Videos
  • Shop
Vital Stats

baudot

Oakland, CA

Member Since 2004

Followers 451 Following 294

  • Everything
  • Photos
  • Video
  • Blogs
  • Groups
  • From Others

Wednesday Nov 02, 2011

Nov 1, 2011
0
  • Facebook
  • Tweet
  • Email
I <3 2> /dev/null

SPOILERS! (Click to view)
.
What language is this?

This is a phrase in bash. Bash is the command language under the hood of macs and most web servers. Specifically, this is a suffix you'd tack on after another command.

What does it say?

">" redirects output from that command somewhere else. Adding the 2 on front only grabs part 2 of the output - the errors.

/dev/null is nowhere. It's a black hole.

So this is a phase we tack onto a mac command under the hood to ignore error messages. (Literally, to redirect error messages into the void.)

Tacking this onto the end of a command strips out the crap error messages flooding your results and leaves the success lines you were searching for. And I <3 that.

Tonight I'm searching a stranger's code to figure out why an event that I want to happen isn't happening. So I'm running a lot of commands like this:

grep -n "FROM LoginInfo" `find ./ -name "*.j*"` 2> /dev/null



grep is the "Global Regular Expression Parser". It's an all purpose search command. I'm using it to look for the text "FROM LoginInfo". The -n bit tells it that I also want to know the line number whenever it finds that text in a file.

The next part is telling it where to look. grep commands normally look like:
grep <what> <where>
In this case, I've got another command within backticks in the where slot:
`find ./ -name "*.j*"`

The backticks say, take this command, and use it's output in this spot.

I'm using the find command to list every file that has a 'j' in the last part of it's name, from this directory on down.

So, in full, the command:

grep -n "FROM LoginInfo" `find ./ -name "*.j*"` 2> /dev/null


translates to:

Find everywhere that "FROM LoginInfo" appears in any file with a j in its name from this directory on down. Tell me what line number you found it on, too, and don't bother me with all the places you couldn't find it.



Why is that awesome?
Screw the haystack. Here's the needle I'm looking for, in 0.2 seconds.

More Blogs

  • 03.28.14
    7

    Wandering Off From the Site

    When my account expires in a month or so, I'll be taking a hiatus. …
  • 02.18.14
    9

    Kate Upton, in zero-gravity and a bikini.

    Edit: The video embed isn't working. Go Here
  • 02.14.14
    2

    Oh, Valentines again.

    The holiday is everywhere, even where I can't miss it, in the Googl…
  • 01.21.14
    8

    Your Favorite Posts

    Link me to your favorite recent posts, please. With the …
  • 12.29.13
    7

    2013: The Year in Tech-Ups

    2013 : The Year 1990's Science Fiction Became Everyday Life March 2…
  • 12.19.13
    0

    Home Early for the Holidays

    I got back to my hometown (wee Mobile, Alabama) early for the holid…
  • 12.08.13
    4

    On the 107th Birthday of Grace Hopper

    Thanks, google, for today's doodle, reminding us of Admiral Grace H…
  • 12.03.13
    8

    Really Enjoying: Orphan Black

    It's a BBC TV show. Sci Fi? Intrigue? It's hard to say. But it does…
  • 11.29.13
    6

    Testing video embeds.

  • 11.14.13
    13

    Soundtracks for Stories

    Songs get tied to characters and stories for me. It's the same for …

We at SuicideGirls have been celebrating alternative pin-up girls for:

23
years
9
months
11
days
  • 5,509,826 fans
  • 41,393 fans
  • 10,327,617 followers
  • 4,593 SuicideGirls
  • 1,120,024 followers
  • 14,922,169 photos
  • 321,315 followers
  • 61,396,762 comments
  • Join
  • Profiles
  • Groups
  • Photos
  • Videos
  • Shop
  • Help
  • About
  • Press
  • LIVE

Legal/Tos | DMCA | Privacy Policy | 18 U.S.C. 2257 Record-Keeping Requirements Compliance Statement | Contact Us | Vendo Payment Support
©SuicideGirls 2001-2025

Press enter to search
Fast Hi-res

Click here to join & see it all...

Crop your photo