Linux workstation

advertisement
計算機概論實習
Linux workstation
Week 3
Linux
• Unix: AT&T Laboratories, 1969
– Ken Thompson and Dennis Ritchie
• GNU: the GNU OS, “Hurd”
– GNU General Public License
• BSD: Berkeley Software Distribution, 1977
– USL(AT&T) v. BSDi
• MINIX: Andrew S. Tanenbaum, 1987
– 16-bit, microkernel
– Birth of Intel 386 (32-bit)
Freax!
• Linux: Linus Torvalds
– Monolithic kernel
– 32-bit (Intel 386 \:D/)
• GNU/Linux
• (FYI)
– Monolithic
– Microkernel
– Hybrid
Linux Distros
•
•
•
•
•
•
Fedora (Red Hat)
openSUSE (Novell)
Ubuntu (Canonical Ltd.)
Mandriva Linux (Madriva)
Debian
Mageia
NTUIM GNU/Linux Workstations
• 140.112.106.6 (mercury)
• 140.112.106.9 (mars)
SSH vs. Telnet
• Both connect to remote servers
• Telnet by default
– Plain text
– No encryption
– No authentication
• SSH
– More secure
– More overhead
PuTTY/PieTTY
• A small and safe Telnet/SSH remote client
• PuTTY
– http://the.earth.li/~sgtatham/putty/latest/x86/putty.
exe
• PieTTY
– http://ntu.csie.org/~piaip/pietty/
– Unicode 補完
– 多國語系
• Just input server’s address, tick SSH, and you’re
on!
Uses
• Compile your C/C++ code
– OS (thread)
– Network (socket)
• Manage your files
UNIX File and Directory
• File
– A sequence of bytes
• Directory
– A file that includes info on how to find other files
/
vmunix
console
dev
lp0
bin
…
csh
lib
…
libc.a
usr
…
include
etc
…
passwd
…
File Permission (1/2)
Output of ls -l
total 4
lrwxr-xr-x 1 test user 18 Aug 28 13:41 home -> /usr/people/maria/
-rw-r--r-- 1 test user 94 Aug 28 13:42 nothing.txt
drwxr-xr-x 2 test user 9 Aug 28 13:40 test_dir/
Permissions
Group
File type
Owner
Modify date File name
File Permission (2/2)
• File permissions
– Permissions used to allow/disallow access to file/directory
contents
– Owner/Group/Other
– Read (r) 4, write (w) 2, and execute (x) 1
– For owner, group, and world (everyone)
• chmod <mode> <file(s)>
• chmod 700 file.txt
• chmod g+rw file.txt
Some commands
Command
Outcome
cd [directory name]
Change directory
cd ..
Change to parent directory
ls
List information about current directory
pwd
Print current working directory
clear
Clear terminal screen
chmod
Change the access permissions of files and directories
uname
Print system information
passwd
Modify a user password
mkdir [dir. name]
Create new folder
rm [file name]
Remove file
Rmdir [dir. name]
Remove directory
cp [origin] [dest.]
Copy file
More commands
Command
Outcome
vim [file name]
Open Vim text editor for file name
> [file name]
Print returned result to file name
| grep
Search result for matching expression
./[executable]
Execute program executable
cat [file name]
Read file name (there are other uses)
Vim Command
Outcome
<ESC>
Standby for command
:q
Quit
:q!
Force quit
:w
Write file
a
Insert text
Homework
Linux command
簡單的微練習
Due Day: 2012/10/3 計概課前
請到 /home/r101042/labtemp
複製 execute_me 這隻程式到自己的資料夾(在labtemp裡面喔)
下,然後執行這隻程式,並把結果輸出成 answer.txt
在自己的資料夾底下
以vim編輯一個以自己學號為名的檔案,裡面打著自己的學
號並存檔
用清單列出資料夾下的所有檔案或資料夾,把結果輸出成
result.txt
用清單列出 labtemp 資料夾底下任何包含有 ”3” 的檔案或資
料夾,把結果輸出成 special.txt
Q&A
Thanks for attention!
Download