jr3 (63K)

One-liners

Posted by Jessica Sun, 07 Jan 2007 04:18:00 GMT

and Frequently used commands I can’t seem to remember the exact syntax of. Nothin’ fancy.

Linux
find . -name \*.* | xargs grep search_string

    navigate to folder you would like to search, enter this command with the search string you would like to find and this command lists all files containing that string
ps x -Ho pid,args
    lists all of the processes running
find / -name gcc
    finds all folders named gcc
sed '/$/,/' /home/Desktop/jessirae > /home/Desktop/jessirae2
    places a comma at the end of each line
paste -sd '\0' - /home/Desktop/jessirae2 > /home/Desktop/jessirae3
    The NEWLINE character of every line except the last line in each input file will be replaced with a separator

Ruby

"<a href=\"http://www.oldurl.com\">JessiRae.com</a>". gsub(/(http?:\/{2})\S+\.(\w+)(\S+)/,"http://www.jessirae.com/blog/")
    global substitution replaces all instances of some expression in a string with some other string or performs some function on that string
require 'open-uri' .... open(url) { |page| page_content = page.read() page_content }
    returns html from specified webpage

designed by jowensbysandifer