Want to use sed(1) to edit a file in place? Well, to replace every ‘e’ with
an ‘o’, in a file named ‘foo’, you can do:
sed -i.bak s/e/o/g foo
And you’ll get a backup of the original in a file named ‘foo.bak’, but if you
want no backup:
sed -i ” s/e/o/g foo
Posts Tagged ‘unix命令’
Filed under: Unix/Linux
Social Tagging: freebsd • sed • skills • unix命令
Filed under: Unix/Linux
Social Tagging: alias • freebsd • skills • unix命令
You can use aliases to decrease the amount of typing you need to do to get
commands you commonly use. Examples of fairly popular aliases include (in
Bourne shell style, as in /bin/sh, bash, ksh, and zsh):
alias lf="ls -FA"
alias ll="ls -lA"
alias su="su -m"
In csh or tcsh, these would be
alias lf ls -FA
alias [...]
Filed under: Unix/Linux
Social Tagging: freebsd • skills • term • unix命令
If you are running xterm, the default TERM variable will be ‘xterm’. If you
set this environment variable to ‘xterm-color’ instead, a lot of programs will
use colors. You can do this by
TERM=xterm-color; export TERM
in Bourne-derived shells, and
setenv TERM xterm-color
in csh-derived shells.
Filed under: Unix/Linux
Social Tagging: dig • freebsd • skills • unix命令
To find out the hostname associated with an IP address, use
dig -x IP_address
— Dru <genesis@istar.ca>
Filed under: Unix/Linux
Social Tagging: cal • freebsd • skills • unix命令
Need to see the calendar for this month? Simply type "cal". To see the
whole year, type "cal -y".
— Dru <genesis@istar.ca>
Filed under: Unix/Linux
Social Tagging: freebsd • sh • skills • unix命令
To change an environment variable in /bin/sh use:
$ VARIABLE="value"
$ export VARIABLE
Filed under: Unix/Linux
Social Tagging: find • freebsd • skills • unix命令
To search for files that match a particular name, use find(1); for example
find / -name "*GENERIC*" -ls
will search ‘/’, and all subdirectories, for files with ‘GENERIC’ in the name.
– Stephen Hilton <nospam@hiltonbsd.com>
Filed under: Unix/Linux
Social Tagging: df • freebsd • skills • unix命令
If you want df(1) and other commands to display disk sizes in
kilobytes instead of 512-byte blocks, set BLOCKSIZE in your
environment to ‘K’. You can also use ‘M’ for Megabytes or ‘G’ for
Gigabytes. If you want df(1) to automatically select the best size
then use ‘df -h’.
Filed under: Unix/Linux
Social Tagging: freebsd • skills • unix命令 • wc
Want to know how many words, lines, or bytes are contained in a file? Type
"wc filename".
— Dru <genesis@istar.ca>

RSS
Sina微博
twitter