http://www.twbsd.org/cht/book/index.php?ch=24
Sadless is a good man, but you can not see it through.
2008年12月4日 星期四
2008年5月21日 星期三
更改提示字元
鳥哥
PS1='\u@\h:\w # '
\d :代表日期,格式為 Weekday Month Date,例如 "Mon Aug 1"
\H :完整的主機名稱。舉例來說,鳥哥的練習機 linux.dmtsai.tw ,那麼這個主機名稱就是 linux.dmtsai.tw
\h :僅取主機名稱的第一個名字。以上述來講,就是 linux 而已, .dmtsai.tw 被省略。
\t :顯示時間,為 24 小時格式,如: HH:MM:SS
\T :顯示時間,12 小時的時間格式!
\A :顯示時間,24 小時格式, HH:MM
\u :目前使用者的帳號名稱;
\v :BASH 的版本資訊;
\w :完整的工作目錄名稱。家目錄會以 ~ 取代;
\W :利用 basename 取得工作目錄名稱,所以僅會列出最後一個目錄名。
\# :下達的第幾個指令。
\$ :提示字元,如果是 root 時,提示字元為 # ,否則就是 $ 囉~
PS1='\u@\h:\w # '
\d :代表日期,格式為 Weekday Month Date,例如 "Mon Aug 1"
\H :完整的主機名稱。舉例來說,鳥哥的練習機 linux.dmtsai.tw ,那麼這個主機名稱就是 linux.dmtsai.tw
\h :僅取主機名稱的第一個名字。以上述來講,就是 linux 而已, .dmtsai.tw 被省略。
\t :顯示時間,為 24 小時格式,如: HH:MM:SS
\T :顯示時間,12 小時的時間格式!
\A :顯示時間,24 小時格式, HH:MM
\u :目前使用者的帳號名稱;
\v :BASH 的版本資訊;
\w :完整的工作目錄名稱。家目錄會以 ~ 取代;
\W :利用 basename 取得工作目錄名稱,所以僅會列出最後一個目錄名。
\# :下達的第幾個指令。
\$ :提示字元,如果是 root 時,提示字元為 # ,否則就是 $ 囉~
2008年5月18日 星期日
configure; make; make install 的道理~感謝Willy分享
reference from http://tldp.org/LDP/LG/current/smith.html
configure; make; make install
Submitted by Willy on Saturday, November 22, 2003 - 12:55
Over and over I have heard people say that you just use the usual configure, make, make install sequence to get a program running. Unfortunately, most people using computers today have never used a compiler or written a line of program code. With the advent of graphical user interfaces and applications builders, there are lots of serious programmers who have never done this.
What you have are three steps, each of which will use a whole host of programs to get a new program up and running. Running configure is relatively new compared with the use of make. But, each step has a very distinct purpose. I am going to explain the second and third steps first, then come back to configure.
The make utility is embedded in UNIX history. It is designed to decrease a programmer's need to remember things. I guess that is actually the nice way of saying it decreases a programmer's need to document. In any case, the idea is that if you establish a set of rules to create a program in a format make understands, you don't have to remember them again.
To make this even easier, the make utility has a set of built-in rules so you only need to tell it what new things it needs to know to build your particular utility. For example, if you typed in make love, make would first look for some new rules from you. If you didn't supply it any then it would look at its built-in rules. One of those built-in rules tells make that it can run the linker (ld) on a program name ending in .o to produce the executable program.
So, make would look for a file named love.o. But, it wouldn't stop there. Even if it found the .o file, it has some other rules that tell it to make sure the .o file is up to date. In other words, newer than the source program. The most common source program on Linux systems is written in C and its file name ends in .c.
If make finds the .c file (love.c in our example) as well as the .o file, it would check their timestamps to make sure the .o was newer. If it was not newer or did not exist, it would use another built-in rule to build a new .o from the .c (using the C compiler). This same type of situation exists for other programming languages. The end result, in any case, is that when make is done, assuming it can find the right pieces, the executable program will be built and up to date.
The old UNIX joke, by the way, is what early versions of make said when it could not find the necessary files. In the example above, if there was no love.o, love.c or any other source format, the program would have said:
make: don't know how to make love. Stop.
Getting back to the task at hand, the default file for additional rules in Makefile in the current directory. If you have some source files for a program and there is a Makefile file there, take a look. It is just text. The lines that have a word followed by a colon are targets. That is, these are words you can type following the make command name to do various things. If you just type make with no target, the first target will be executed.
What you will likely see at the beginning of most Makefile files are what look like some assignment statements. That is, lines with a couple of fields with an equal sign between them. Surprise, that is what they are. They set internal variables in make. Common things to set are the location of the C compiler (yes, there is a default), version numbers of the program and such.
This now beings up back to configure. On different systems, the C compiler might be in a different place, you might be using ZSH instead of BASH as your shell, the program might need to know your host name, it might use a dbm library and need to know if the system had gdbm or ndbm and a whole bunch of other things. You used to do this configuring by editing Makefile. Another pain for the programmer and it also meant that any time you wanted to install software on a new system you needed to do a complete inventory of what was where.
As more and more software became available and more and more POSIX-compliant platforms appeared, this got harder and harder. This is where configure comes in. It is a shell script (generally written by GNU Autoconf) that goes up and looks for software and even tries various things to see what works. It then takes its instructions from Makefile.in and builds Makefile (and possibly some other files) that work on the current system.
Background work done, let me put the pieces together.
You run configure (you usually have to type ./configure as most people don't have the current directory in their search path). This builds a new Makefile.
Type make This builds the program. That is, make would be executed, it would look for the first target in Makefile and do what the instructions said. The expected end result would be to build an executable program.
Now, as root, type make install. This again invokes make, make finds the target install in Makefile and files the directions to install the program.
This is a very simplified explanation but, in most cases, this is what you need to know. With most programs, there will be a file named INSTALL that contains installation instructions that will fill you in on other considerations. For example, it is common to supply some options to the configure command to change the final location of the executable program. There are also other make targets such as clean that remove unneeded files after an install and, in some cases test which allows you to test the software between the make and make install steps.
2007年10月15日 星期一
2007年9月4日 星期二
背景執行 ~ bg / fg / & / screen / Ctrl_a+d
http://linux.vbird.org/linux_basic/0440processcontrol.php
執行程式
Ctrl_Z (中斷程式)
bg (背景執行)
fg (帶到前景)
=============================
或是 > command & 也可以(&放後面)
=============================
screen 用法:
C-a d -> detach,將目前的 screen session (可能含有多個 windows) 丟到後臺執行
screen -r
There are several suitable screens on:
6263.pts-1.ec-base (Detached)
6382.pts-1.ec-base (Detached)
screen -r 6263
Ctrl_a+d 暫時離開 screen
Ctrl_d 關閉screen
http://blog.roodo.com/albertarea/archives/3358957.html
http://tavi.debian.org.tw/index.php?page=screen
執行程式
Ctrl_Z (中斷程式)
bg (背景執行)
fg (帶到前景)
=============================
或是 > command & 也可以(&放後面)
=============================
screen 用法:
C-a d -> detach,將目前的 screen session (可能含有多個 windows) 丟到後臺執行
screen -r
There are several suitable screens on:
6263.pts-1.ec-base (Detached)
6382.pts-1.ec-base (Detached)
screen -r 6263
Ctrl_a+d 暫時離開 screen
Ctrl_d 關閉screen
http://blog.roodo.com/albertarea/archives/3358957.html
http://tavi.debian.org.tw/index.php?page=screen
自訂工作路徑 .bashrc
由於是隱藏檔,所以要用 ls -a 才看得到。
有很多個,都會放在登入的那個路徑下。
如, .login、.cshrc、.tcshrc、.bashrc、.bash_profine、.bash_login
可能會跟系統不同而不同。
我試著更改了 .bashrc 裡面的 cd / 變成 cd /panos
就可以把登入的位置改到別的地方去,重新登入後,那些 .bash* 檔 都會自動移到/panos該路徑下。
改 .bashrc 裡面的東西,terminal 要重新開一個才有用。
有很多個,都會放在登入的那個路徑下。
如, .login、.cshrc、.tcshrc、.bashrc、.bash_profine、.bash_login
可能會跟系統不同而不同。
我試著更改了 .bashrc 裡面的 cd / 變成 cd /panos
就可以把登入的位置改到別的地方去,重新登入後,那些 .bash* 檔 都會自動移到/panos該路徑下。
改 .bashrc 裡面的東西,terminal 要重新開一個才有用。
chmod ~ 更換權限
chmod XXX filename
數字越大,權限越低。
r w x
4+2+1 = 7
chmod 421 filename
得到
-r___w___x 這個權限
而這三個數字 分別代表是 "自己"、"同group的人"、"其他人" 的權限。
數字越大,權限越低。
r w x
4+2+1 = 7
chmod 421 filename
得到
-r___w___x 這個權限
而這三個數字 分別代表是 "自己"、"同group的人"、"其他人" 的權限。
2007年7月24日 星期二
2007年4月25日 星期三
訂閱:
文章 (Atom)