Ubuntu BASH shell command tricks

BASH tricks 

 

1. TAB key, autocomplete

 

2. Piping output

e.g.: 

ls -al | less

ls -al | grep -i flower

history | less

 

3. Redirecting output

e.g.:

ls -l > directory_listing.txt

ls -l >> directory_listing.txt

ls -l > ~/file_list.txt

sort < ~/file_list.txt > ~/file_list_sorted.txt

4. Using Brace Expansion

e.g.:

mkdir Photo{a,b,c}

mkdir photo{A..Z}

rmdir photo{A..Z}

 

posted @ 2011-01-18 13:56  庚武  Views(168)  Comments(0Edit  收藏  举报