1. Enable the FreeBSD terminal to support color
Ls-G will show the color
Csh in the. cshrc file, add: alias ls = "ls-G"
Sh in the. profile file, add: alias ls = "ls-G"
2. Change the User Login Shell
By default, SH is used for Logon. Sh does not support the tab key.
To switch to CSH, run CSH directly.
If you need to use this command once and for all, use the following command:
Name: The name of your login
PW usermod-N name-s CSH
3. Change the prompt
Set prompt = "#"
You can also add this statement to the. cshrc or. profile configuration file.
4. FreeBSD supports dir
Alias dir "ls"
You can also add this statement to the. cshrc or. profile configuration file.
Alias is similar to doskey in DOS
Turn from: collar test software testing network [http://www.ltesting.net]
Link: http://www.ltesting.net/ceshi/ruanjianceshikaifajishu/rjcshjdj/unix/2007/0701/114663.html
Modify IP Address:
IP: 192.168.21.173
Subnet Mask: 255.255.255.0
Gateway: 192.168.21.2
DNS: 8.8.8.8
8.8.4.4
1. Set IP addresses and gateways
EE/etc/rc. conf # Edit
Ifconfig_em0 = "Inet 192.168.21.173 netmask 255.255.255.0" # Set the IP address and subnet mask
Defaultrouter = "192.168.21.2" # Set the Gateway
Hostname = "FreeBSD" # Set Host Name
Press ESC and press a to save.
System O & M reminder: qihang01 original content is copyrighted. For more information, see the source and original article links.
2. Set DNS
EE/etc/resolv. conf # Edit
Nameserver 8.8.8.8
Nameserver 8.8.4.4
Press ESC and press a to save.
SH/etc/rc # restart the network
/Etc/netstart # restart the network
FreeBSD is now available for Internet access!
Modify FreeBSD-CSH-SHELL operation prompt
After studying FreeBSD for two days, I always feel that the input prompt is strange, and the default prompt does not contain the function of displaying the directory. it is inconvenient to use PWD. Thought of modifying the prompt. Of course. First of all to explain the appropriate scope of this article, I FreeBSD system using CSH-SHELL so only for the CSH-SHELL to explain .. For other shells, see other instructions.
If you do not know what shell your operating system uses, use # echo $ shell to view the shell version. If the version displays/bin/CSH, let's take a look.
To modify the prompt, first find the configuration file about the CSH-SHELL, Which is [#/. cshrc]. Find the file and open it in the editor (the VI Editor opens the statement: # vi /. cshrc if there is no vi editor on your machine, select another text editor. This article will not detail it)
Find the following statement: set prompt = "any matching character"
For example: set prompt = "[email] abc@hotmail.com [/Email] #"
Note: Due to the length, the following content will not be highlighted by the keyword color.
You can find the above statement. The front is about the prompt parameter.
! Same as % H
% B start bold Mode
% B end bold Mode
% C the last part of the current working directory name
% C2, % C3, etc. The last two or three (and so on) components of the current working directory name
% C is similar to % C, but a long directory name is used.
% D the day of the week
% D today is the day of the month
% H history Number of the current command
% L current control terminal of Shell
% L clear all content from the end of the prompt to the next line
Host Name of % m Machine
% M machine's fully compliant Domain Name
% N User Name
% P indicates the 12-hour time displayed in exact format (including seconds)
% P is displayed in a precise format (including seconds) in a 24-hour format.
Standard output format starting from % s
% S end standard output format
% T display time in 12-hour format
% T display time in 24-hour format
% U start underline Mode
% U end underline Mode
% W name of the current month
% W the ordinal number of the current month
% Y indicates the year in 2-digit format
% Y year in 4-digit format
% Characters
%! Same as % H
% @ Is the same as % t
$ # Extended to> for general use. If the user is running as root, it is extended #
%/Full name of the current working directory
%-Current working directory in short format
^ Control characters matching C and C: for example, ^ g Represents Ctrl + G
\ A enables tcsh to beep when the prompt is displayed at any time
\ E Ended Escape Character 0x1b
\ F ended form feed
\ N starts a new line at this position
\ R carriage return
\ T Tab
\ V vertical Tab
\ NNN is a character specified by the octal number NNN.
Solaris change system prompt
This depends on your shell. Some shells are easy, some shells are difficult, and some are
This cannot be done.
C shell (CSH ):
Add the following to your. cshrc.
Alias setprompt 'set prompt = "$ {CWD} % "'
Setprompt # To set the initial prompt
Alias CD 'chdir \! * & Setprompt'
If you use pushd and popd, add the following content.
Alias pushd 'pushd \! * & Setprompt'
Alias popd 'popd \! * & Setprompt'
If your c shell does not have the variable $ CWD, replace it with 'pwd.
If you only want prompt to have the last component of the current directory
("Mail %" And? Nbsp; "/usr/spool/mail % ")
Alias setprompt 'set prompt = "$ CWD: T % "'
Some earlier versions of CSH reversed the meaning of & |. You can try:
False & Echo bug
If the result is printed with "bug", check & | or find
CSH of the bug.
Bourn shell (SH ):
If you have a newer version of the bourn shell (svr2 or later), you can
Use a shell function to create your own commands, such as "XCD ":
XCD () {CD $ *; PS1 = "'pwd' $ ";}
If your bourn shell is a relatively old version, it can also be done, but the method is similar
Complex. Here is a method. Add the following content to your. Profile:
Login_shell = $ export login_shell
Export File =/tmp/CD. $ export Upload File
#16 is sigurg, pick a signal that's not likely to be
Used
Promptsig = 16 Export promptsig
Trap '. $ specify File' $ promptsig
Write the following parts as an executable script (no need to scale down ).
It is called "XCD" and put it in your path.
: XCD directory-Change directory and set prompt
: By signalling the login shell to read a command file
Cat >$ {upload file? "Not set"} <CD $1
PS1 = "\ 'pwd \ '$"
EOF
Kill-$ {promptsig? "Not set" }$ {login_shell? "Not set "}
Now, you can use "XCD/Some/DIR" to change the working directory.
Korn shell (Ksh ):
Add the following line to your. Profile:
PS1 = '$ PWD $'
If you only want to display the last part, use
PS1 = '$ {PWD ##*/} $'
T c shell (tcsh)
Tcsh is a commonly used enhanced version of CSH, which adds some built-in variables (and many other functions
Yes ):
% ~ The current directory, using ~ For $ home
%/The full pathname of the current directory
% C or %. The trailing component of the current directory
So you can directly use
Set prompt = '% ~ '
Bash (FSF's "Bourne again shell ")
$ \ W in PS1 indicates the complete path of the working directory (~ $ Home); \ W
Is the last part of the working directory. Therefore, you only need
Make the following changes to the KSh method:
PS1 = '\ W $'
Or
PS1 = '\ W $'
Enable the FreeBSD terminal to also display the color: CSH adds alias ls LS-G to the. cshrc file
Reference: http://blog.sina.com.cn/s/blog_60c53e470100e4ec.html
Http://www.dedecms.com/knowledge/servers/linux-bsd/2012/0819/8375.html
Http://hi.baidu.com/wjmckluzdpcfiye/item/8f65b95b61ea29444fff2068