
Terminal - All commands - 12,454 results
This is sample output - yours may be different.
CRONTAB(5) CRONTAB(5)
NAME
crontab - tables for driving cron
DESCRIPTION
A crontab file contains instructions to the cron(8) daemon of the gen‐
eral form: ??run this command at this time on this date??. Each user
has their own crontab, and commands in any given crontab will be exe‐
cuted as the user who owns the crontab. Uucp and News will usually
have their own crontabs, eliminating the need for explicitly running
su(1) as part of a cron command.
You can view the man pages from section five by passing the section number as an argument to the man command
function fcd () { [ -f $1 ] && { cd $(dirname $1); } || { cd $1 ; } pwd }
This is sample output - yours may be different.
# assume EVN is setup - adding for context.
cd
postmaster=${HOME}/Mail/2009/Aug/System/postmaster
mkdir -p $(dirname $postmaster) ; touch $postmaster
##
fcd $postmaster
/home/smith/Mail/2009/Aug/System
fcd : file change directory
A bash function that takes a fully qualified file path and cd's into the directory where it lives. Useful on the commadline when you have a file name in a variable and you'd like to cd to the directory to RCS check it in or look at other files associated with it.
Will run on any ksh, bash, likely sh, maybe zsh.
find . -type f -exec grep -qi 'foo' {} \; -print0 | xargs -0 vim
This is sample output - yours may be different.
Make sure that find does not touch anything other than regular files, and handles non-standard characters in filenames while passing to xargs.
bash -x test.sh 2>&1 | tee out.test
This is sample output - yours may be different.
Sends both stdout and stderr to the pipe which captures the data in the file 'out.test' and sends to stdout of tee (likely /dev/tty unless redirected). Works on Bourne, Korn and Bash shells.
This is sample output - yours may be different.
find . -exec grep foobar /dev/null {} \; | awk -F: '{print $1}' | xargs vi
This is sample output - yours may be different.
needs no GNU tools, as far as I see it
grep -ir 'foo' * | awk -F '{print $1}' | xargs vim
This is sample output - yours may be different.
saves one command. Needs GNU grep though :-(
grep -Hrli 'foo' * | xargs vim
This is sample output - yours may be different.
The grep switches eliminate the need for awk and sed. Modifying vim with -p will show all files in separate tabs, -o in separate vim windows. Just wish it didn't hose my terminal once I exit vim!!
grep -ir 'foo' * | awk '{print $1}' | sed -e 's/://' | xargs vim
This is sample output - yours may be different.
This will drop you into vim to edit all files that contain your grep string.
file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -i x86_64 |nl |tail -1 |cut -f1 -f3 && file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -v x86_64 |nl |tail -1 |cut -f1 -f3
This is sample output - yours may be different.
127 Mach-O 64-bit kext bundle x86_64
314 Mach-O object i386
Next time you see a mac fanboy bragging about 64-bitness of 10.6 give him this so he might sh?
O=$IFS;IFS=$'\n'; D=$(for f in *;do [[ -d $f ]] && du -sh "$f";done | sort -gr);F=$(for f in *;do [[ -f $f ]] && du -sh "$f";done | sort -gr);IFS=$O;echo "$D";echo "$F"
This is sample output - yours may be different.
]> O=$IFS;IFS=$'\n'; D=$(for f in *;do [[ -d $f ]] && du -sh "$f";done | sort -gr);F=$(for f in *;do [[ -f $f ]] && du -sh "$f";done | sort -gr);IFS=$O;echo "$D";echo "$F"
172K images
8.0K css
8.0K index.html~
8.0K index.html
or alias memorable-command=']> O=$IFS;IFS=$'\n'; D=$(for f in *;do [[ -d $f ]] && du -sh "$f";done | sort -gr);F=$(for f in *;do [[ -f $f ]]
&& du -sh "$f";done | sort -gr);IFS=$O;echo "$D";echo "$F"'
and run memorable-command
biggest->small directories, then biggest->smallest files
echo sortmeplease|sed 's/./&\n/g'|sort|tr -d '\n'
This is sample output - yours may be different.
ls -lct /etc | tail -1 | awk '{print $6, $7}'
This is sample output - yours may be different.
$ ls -lct /etc | tail -1 | awk '{print $6, $7}'
2009-08-25 13:25
Show time and date when you installed your OS.
echo sortmeplease | awk '{l=split($1,a,"");asort(a);while(x<=l){printf "%s",a[x];x++ }print "";}'
This is sample output - yours may be different.
using awk
missed the last char thanks @Josay
echo {1..199}" sheep," | espeak -v english -s 80
This is sample output - yours may be different.
1 sheep, 2 sheep, 3 sheep, ...
ZZZZZzzzzzzzzzz...
Can change language and speed, see espeak man page for options. (Install espeak in your linux distro via yum or apt-get)
For insomniacs you may need to enclose in a while true; do ...; done loop ;)
dd bs=1 seek=2TB if=/dev/null of=ext3.test
This is sample output - yours may be different.
This is sample output - yours may be different.
> ls
total 24K
4.0K css/ 4.0K images/ 8.0K index.html 8.0K index.html~
use manpages, they give you "ultimate commands"
"ls -SshF --color" list by filesize (biggest at the top)
"ls -SshFr --color" list by filesize in reverse order (biggest at the bottom)
sudo dscl localhost -append /Local/Default/Groups/admin GroupMembership username
This is sample output - yours may be different.
adding users to groups on OS X is not a straightforward process, you need to use the new in built in Directory Service command line utility...
echo sortmeplease | grep -o . | sort | tr -d '\n'; echo
This is sample output - yours may be different.
$ echo sortmeplease | grep -o . | sort | tr -d '\n'; echo
aeeelmoprsst
Sorts a character string, using common shell commands.
This is sample output - yours may be different.
using bc is for sissies. dc is much better :-D
Polish notation will rule the world...
find ~/Library/Application\ Support/Firefox/ -type f -name "*.sqlite" -exec sqlite3 {} VACUUM \;
This is sample output - yours may be different.
nmap -R -sL 209.85.229.99/27 | awk '{if($3=="not")print"("$2") no PTR";else print$3" is "$2}' | grep '('
This is sample output - yours may be different.
(209.85.229.96) is ww-in-f96.google.com
(209.85.229.97) is ww-in-f97.google.com
(209.85.229.98) is ww-in-f98.google.com
(209.85.229.99) is ww-in-f99.google.com
(209.85.229.100) is ww-in-f100.google.com
(209.85.229.101) is ww-in-f101.google.com
(209.85.229.102) is ww-in-f102.google.com
(209.85.229.103) is ww-in-f103.google.com
(209.85.229.104) is ww-in-f104.google.com
(209.85.229.105) is ww-in-f105.google.com
(209.85.229.106) is ww-in-f106.google.com
(209.85.229.107) no PTR
(209.85.229.108) no PTR
(209.85.229.109) no PTR
(209.85.229.110) no PTR
(209.85.229.111) no PTR
(209.85.229.112) is ww-in-f112.google.com
(209.85.229.113) is ww-in-f113.google.com
(209.85.229.114) no PTR
(209.85.229.115) is ww-in-f115.google.com
(209.85.229.116) is ww-in-f116.google.com
(209.85.229.117) no PTR
(209.85.229.118) is ww-in-f118.google.com
(209.85.229.119) no PTR
(209.85.229.120) is ww-in-f120.google.com
(209.85.229.121) no PTR
(209.85.229.122) no PTR
(209.85.229.123) is ww-in-f123.google.com
(209.85.229.124) no PTR
(209.85.229.125) is ww-in-f125.google.com
(209.85.229.126) is ww-in-f126.google.com
(209.85.229.127) is ww-in-f127.google.com
This command uses nmap to perform reverse DNS lookups on a subnet. It produces a list of IP addresses with the corresponding PTR record for a given subnet. You can enter the subnet in CDIR notation (i.e. /24 for a Class C)). You could add "--dns-servers x.x.x.x" after the "-sL" if you need the lookups to be performed on a specific DNS server.
On some installations nmap needs sudo I believe. Also I hope awk is standard on most distros.
This is sample output - yours may be different.
-l auto-selects many more digits (but you can round/truncate in your head, right) plus it loads a few math functions like sin().
awk '/d.[0-9]/{print $4}' /proc/partitions
This is sample output - yours may be different.
sda1
sda2
sda3
sda5
sda6
sda7
sda8
sda9
sdb1
Only one command and not dependant on full read access to the devices.
fdisk -l |grep -e '^/' |awk '{print $1}'|sed -e "s|/dev/||g"
This is sample output - yours may be different.
hdc1
hdc2
hdc5
hdd1
hdd2
hdd5