ipython has some bugs in it, but readline and tabcompletion are not-exactly-modern marvels
so, add this to your .bashrc
alias pysh='python -ic "import readline, rlcompleter;readline.parse_and_bind('\''tab:complete'\'')"'
credit for this one goes to MostAwesomeDude
Thursday, June 30, 2011
Thursday, June 23, 2011
Find 3.2
While find can be used to recursive perform an operation on files with the -exec flag, doing so can be costly. In the case of recursive permissions, you could change
To
chmod -R a+rX .
This recursively adds the read bit to all files, and if the execute bit is set for user, group, or other on the file, it is applied for all else. If you're updating 10000+ files, this will run much faster. (And it's easier to type.)
find . -type f -exec chmod 644 {} + -o -type d -exec chmod 755 {} +
To
chmod -R a+rX .
This recursively adds the read bit to all files, and if the execute bit is set for user, group, or other on the file, it is applied for all else. If you're updating 10000+ files, this will run much faster. (And it's easier to type.)
Wednesday, June 22, 2011
ldapsearchin
ldapsearch -LLL -x -h ldap.schoolname.edu -D uid=me,ou=People,dc=shcoolname,dc=edu -b ou=Group,dc=schoolname,dc=edu gidNumber=* gidNumber |grep gidNumber | cut -f2 -d" " | sort -g
Monday, June 20, 2011
Find 3.1
Here are the last two finds combined into a one-liner:
find . -type f -exec chmod 644 {} + -o -type d -exec chmod 755 {} +
The '+' can replace the escaped ';' to tell the find exec to collect all the files first, and then execute (think xargs). And the '-o' will be short-circuited, so it will only test for a type of 'd' if the type is not 'f'.
find 3
First, find all directories starting in the current directory and recursing deeper, and chmod them all to 755.
Then, find all files starting in the current directory and recursing deeper, and chmod them all to 644.
Sweet.
find . -type d -exec chmod 755 {} \;
Then, find all files starting in the current directory and recursing deeper, and chmod them all to 644.
find . -type f -exec chmod 644 {} \;
Sweet.
Saturday, June 18, 2011
Friday, June 17, 2011
find
the first in a series on find
find . | xargs grep foobar
Innagural spell
Using cut to chop things
Will print out the first part up to the '-' of every line in the file /etc/dfs/sharetab
cut -f1 -d"-" /etc/dfs/sharetab
Will print out the first part up to the '-' of every line in the file /etc/dfs/sharetab
Subscribe to:
Posts (Atom)