Tuesday, March 04, 2008

Linux 一句话精彩问答基础知识 - Linux Unix As400

Linux 一句话精彩问答基础知识 - Linux Unix As400: "在有scsi硬盘的计算机上,如果用上面的命令挂载usb闪存,则会mount到/boot分区。这种情
况,应该先用fdisk -l /dev/sd? 来看看到底usb闪存盘是在哪个设备下(通常会是sdb或者sdc)。
比如某台机器上,就是在sdc1 上面。
所有/etc/fstab 内容 mount -a 指定文件格式'-t 格式', 格式可以为vfat, ext2, ext3 等.
访问DVD mount -t iso9660 /dev/dvd /mnt/cdrom 或mount -t udf /dev/dvd /mnt/cdrom
注意:dvd 的格式一般为iso9660 或udf 之一
1006 在vmware 的LINUX 中使用本地硬盘的FAT 分区
将本地的FAT 分区共享,然后在VMWARE 中使用SMBFS 挂上。可以将如下的行放到
/etc/fstab 中:"

homework #1 set environment

-bash-3.00$ vi homework-1
CS385 Homework Assignment 1a
Subject: customize shell environment start up configuration file(s)
Due Date: Mar. 4, 2008

A. Study and understand each entry in the ".cshrc" and ".tcshrc" (if applicable) under your UNIX home directory on NPU's Sun workstation systems
B. COPY /cs385/.cshrc.base as your template and refer sample files ".cshrc.sample" and ".tcshrc.sample" under /cs385 on NPU48 (ONLY on NPU48!)
C. Polish your VI editing skill, make sure you are comfortable with cursor movement and vi commands
D. Create a duplicate of your current ".cshrc" file; Open 2nd connection to NPU48; edit ".cshrc" with VI:
i. Clean up unwanted and obsoleted entries such as lpath, extra aliases and comment-out lines
ii. Correct environment variables as appropriate, in particular, PATH, MANPATH, most importatnt function keys such as ERASE, INTERRUPT, STOP, SUSPEND, EOF and KILL; creat your favoriate aliases; add variable such as tabs, umask, filec, tty, noclobber, and history et al. set your prompt so it will display (minimum the following) your login-name, hostname (system name) and current working directory.
iii. Save your changes; execute command "source ~/.cshrc" or equivalent(.) in other shell to configure the file
iv. if no error after execution, you are ok; otherwise, repeate steps i through iii until no error
v. customize your .bash_profile in a way similar to above for .cshrc
E. Turn in a hard copy of your customzied ".cshrc" and ".bash_profile" file plus a soft copy to NPU48:/cs385/hmwk/hmwk-1 with a unique name such as "your-unix-login-name.cshrc" and "your-unix-login-name.bash_profile"

F. These who copy AND allow-others-to-copy their homework will get NULL for sure.

======Optional Bonus Questions ======
locate the ssh program embeded finger-print file for security keies on your Windows desktop


when finish:
1.soft.copy-> npu48: /cs385/hmwk/hmwk-1 with unique name.
2.hand.copy-> TA.


1..cshrc npu3 .33 for try csh






[npu3:/home/hanyunfan] cat .cshrc |more
# @(#)Cshrc 1.6 03/03/08 Frank
#################################################################
#
# .cshrc file
#
# For homework of cs385
# C-Shells
#
#################################################################

# Set Core Dump Size
limit coredumpsize 0k

set path = (~ $lpath ~/bin /usr/local/bin /usr/local/netscape /usr/ucb /usr/bin /usr/etc)
setenv MANPATH (/usr/man /usr/local/man)
setenv TERM=vt100
stty erase '^H' kill '^U' intr '^C' eof '^D' stop '^S' suspend '^z'

alias cd 'cd \!*;echo $cwd'
alias cp 'cp -i'
alias mv 'mv -i'
alias rm 'rm -i'
alias pwd 'echo $cwd'
alias h 'history \!* | head -39 | more'
alias dir 'ls'
alias pdw 'echo $cwd'
alias la 'ls -a'
alias ls 'ls -GF'

set ignoreeof # in case of ctrl+d
set noclobber # do not rewite exist file
set history=100
set savehist=40
set filec
set autolist
#set prompt="$USER@'hostname',<$cwd>:"
set prompt="%n%u@%m %~:"
umask 022









#.bash_profile
# Set Core Dump Size
limit coredumpsize 0k

export PATH =~:$lpath:~/bin:/usr/local/bin:/usr/local/netscape:/usr/ucb:/usr/bin:/usr/etc
export MANPATH /usr/man:/usr/local/man
set TERM=vt100;exprot TERM
export EDITOR=vi
stty erase '^H' kill '^U' intr '^C' eof '^D' stop '^S' suspend '^z'

alias cd 'cd \!*;echo $cwd'
alias cp 'cp -i'
alias mv 'mv -i'
alias rm 'rm -i'
alias pwd 'echo $cwd'
alias h 'history \!* | head -39 | more'
alias dir 'ls'
alias pdw 'echo $cwd'
alias la 'ls -a'
alias ls 'ls -GF'

set ignoreeof # in case of ctrl+d
set noclobber # do not rewite exist file
set history=100
set savehist=40
set filec
set autolist
export PS1="[\u@\h \W]\$"
umask 022

我的.cshrc文件

我的.cshrc文件: "# $FreeBSD: src/etc/root/dot.cshrc,v 1.29 2004/04/01 19:28:00 krion Exp $

#

# .cshrc - csh resource script, read at beginning of execution by each shell

#

# see also csh(1), environ(7).

lias h history 25

alias j jobs -l

alias la ls -a

alias lf ls -FA

alias ll ls -lA

alias lls ls -G

# A righteous umask

umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin /usr/local/jdk1.4.2/bin /usr/local/jdk1.4.2/jre/bin $HOME/bin)

setenv EDITOR ee

setenv PAGER more

setenv BLOCKSIZE K

setenv LANG zh_CN.eucCN

setenv LC_ALL zh_CN.eucCN

setenv LC_CTYPE zh_CN.eucCN

setenv JAVA_HOME /usr/local/jdk1.4.2

setenv CLASSPATH .:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/jre

setenv XMODIFIERS @im=fcitx

if ($?prompt) then

# An interactive shell -- set some stuff up

set prompt = '%B%m@%n[%/]# '

set filec

set history = 100

set savehist = 100

set mail = (/var/mail/$USER)

if ( $?tcsh ) then

bindkey '^W' backward-delete-word

bindkey -k up history-search-backward

bindkey -k down history-search-forward

endif

endif"

CSH Multiline prompt Linux on your way - Powered by Sablog-X

CSH Multiline prompt Linux on your way - Powered by Sablog-X: "# %B begin bold
# %b end bold
# %{ begin control escape
# %} end control escape, cannot be the last in prompt
# %m hostname, without domain
# %/ current directory
# %D day in dd format
# %W month in mm format
# %Y year in yyyy format
# %l tty
# %P time in 24 hour format
# %h history number"

Monday, March 03, 2008

tcshshell - pengpeng.popo - 网易博客

tcshshell - pengpeng.popo - 网易博客: "history -c"

history -c

关于Linux操作系统提示符PS1定义的问题-Linux伊甸园----Linux|Unix|新闻|下载|论坛|�

关于Linux操作系统提示符PS1定义的问题-Linux伊甸园----Linux|Unix|新闻|下载|论坛|�

Linux系统提示符是用系统变量PS1来定义的。一般系统默认的形式是:[username@host 工作目录]$.

用echo $PS1可以得到PS1的值,即PS1="[\u@\h \w]"\$

登录后可以更改PS1的显示样式,但是当退出重启登录进入系统后,样式又变成系统默认的样式了,如果要彻底改变它的样式,只能从配置文件中改。

PS是在用户根目录下的.bash_profile中定义的。

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

#以下是设定的PS1的值

PS1="[\u@\h \w]\$"

PATH=$PATH:$HOME/bin

#使用export把PS1输出,以使它可以在子shell中生效,这会造成ROOT用户的也采用此样式

#export PS1 要慎用

export PATH

unset USERNAME

下面简单说说环境下默认的特殊符号所代表的意义:

\d :代表日期,格式为weekday month date,例如:"Mon Aug 1"

\H :完整的主机名称。例如:我的机器名称为:fc4.linux,则这个名称就是fc4.linux

\h :仅取主机的第一个名字,如上例,则为fc4,.linux则被省

\t :显示时间为24小时格式,如:HH:MM:SS

\T :显示时间为12小时格式

\A :显示时间为24小时格式:HH:MM

\u :当前用户的账号名称

\v :BASH的版本信息

\w :完整的工作目录名称。家目录会以 ~代替

\W :利用basename取得工作目录名称,所以只会列出最后一个目

\# :下达的第几个命令

\$ :提示字符,如果是root时,提示符为:# ,普通用户则为:$

(责任编辑:A6)

来源:赛迪网 供稿:sixth  时间: 2007-11-07 13:43:06 评论0条 点击:阅读次数: 308次