Unused Linux Basics
Shellscript File Tests
if [ -e $file ]; then
./myUtil $file
fi
TEST | MEANING |
[ -b $file ] | True if file exists and is block special. |
[ -c $file ] | True if file exists and is character special. |
[ -d $file ] | True if file exists and is a directory. |
[ -e $file ] | True if file exists. |
[ -f $file ] | True if file exists and is a regular file. |
[ -g $file ] | True if file exists and is set-group-id. |
[ -k $file ] | True if file has its ``sticky'' bit set. |
[ -L $file ] | True if file exists and is a symbolic link. |
[ -p $file ] | True if file exists and is a named pipe. |
[ -r $file ] | True if file exists and is readable. |
[ -s $file ] | True if file exists and has a size greater than zero. |
[ -S $file ] | True if file exists and is a socket. |
[ -t $fd ] | True if fd is opened on a terminal. |
[ -u $file ] | True if file exists and its set-user-id bit is set. |
[ -w $file ] | True if file exists and is writable. |
[ -x $file ] | True if file exists and is executable. |
[ -O $file ] | True if file exists and is owned by the effective user id. |
[ -G $file ] | True if file exists and is owned by the effective group id. |
Directory Size Lister/Sorter
du -sm $(find $1 -type d -maxdepth 1 -xdev) | sort -g
style="font-weight: bold;">Finding Who Has a File Open
[slitt@mydesk slitt]$ /sbin/fuser -mu /d
/d: 1693(slitt) 1891c(slitt) 1894 1894c(slitt)
1907 1907c(slitt) 1908 1908c(slitt) 1909 1909c(slitt)
1910 1910c(slitt) 1912 1912c(slitt) 1913 1913c(slitt)
[slitt@mydesk slitt]$
0 comments:
Post a Comment