Tip #205 Convert permissions to octal
Converts the symbolic permissions to octal (ie: numbers) when using 'ls -l':$ls -l | sed -e 's/--x/1/g' -e 's/-w-/2/g' -e 's/-wx/3/g' -e 's/r--/4/g' \ -e 's/r-x/5/g' -e 's/rw-/6/g' -e 's/rwx/7/g' -e 's/---/0/g' -755 1 jrl jrl 111943 2003-10-21 19:57 logscan -644 1 jrl jrl 35468 2003-11-23 16:13 htfoo -700 1 jrl jrl 3100672 2004-05-15 17:00 mutt -644 1 jrl jrl 10162 2005-02-22 14:14 joinstep2.php -777 1 jrl jrl 41079 2005-04-21 13:02 setistats d755 2 jrl jrl 47 2007-10-26 14:41 rf -700 1 jrl jrl 104 2008-02-05 11:26 getcIf you're going to use this, you may want to make an alias rather than type it in each time!
- TAGS:
- sed
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs