Type the following command to disable shell access for tom:

# chsh -s /sbin/nologin {username}
# chsh -s /sbin/nologin tom

Sample Outputs:

Changing shell for tom
Shell changed.

$variable = condition ? if true : if false;

as in:

$age = 24;
$drinkingAge = ($age > 21) ? “have a beer” : “have an iced tea”;

echo $drinkingAge; // returns have a beer

find by name
find /directory -name “filename.ext”
find /directory -name filename.*
find /directory -name *.php

ignore case
find /directory -iname “filename.ext”

invert results (list files that don’t end with .php)
find /home/test ! -name “*.php”

search only 1 directory deep
find /home/test -maxdepth 2 -name “*.php”

only 2 directories deep
find /home/test -maxdepth 3 -name “*.php”

Find all directories
# find . -type d

Find only the normal files
# find . -type f

Find all the hidden files
# find . -type f -name “.*”

Find all the hidden directories
# find -type d -name “.*”

Find files bigger than the given size
# find ~ -size +100M

Find files smaller than the given size
# find ~ -size -100M

Find files that matches the exact given size
# find ~ -size 100M

Accessed files

Find based on minutes (60 minutes)
find /home -amin -60

Long list the files which are accessed within the last 1 hour.
find /home -amin -60 -exec ls -l {} \;

Find based on day(s) (24 hours)
find /home -atime -1

Long list the files which are accessed within the last 1 day.
find /home -atime -1 -exec ls -l {} \;

Modified files

Find based on minutes (60 minutes)
find /home -mmin -60

Long list the files which are accessed within the last 1 hour.
find /home -mmin -60 -exec ls -l {} \;

Find based on day(s) (24 hours)
find /home -mtime -1

Long list the files which are accessed within the last 1 day.
find /home -mtime -1 -exec ls -l {} \;

hide errors (Permission denied)
find -name “*.txt” 2>>/dev/null

To display the full path in the Finder title in Leopard, open Terminal.app and run:
$ defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

then

$ osascript -e ‘tell app “Finder” to quit’

Then relaunch the Finder from the dock. To undo:

$ defaults write com.apple.finder _FXShowPosixPathInTitle -bool NO

© 2012 James Border Suffusion theme by Sayontan Sinha