Presentation is loading. Please wait.

Presentation is loading. Please wait.

HKOI 2012 TRAINING INTRO TO LINUX /CUHK/SHB123]$ date Sat Feb 18 13:00:00 HKT 2012.

Similar presentations


Presentation on theme: "HKOI 2012 TRAINING INTRO TO LINUX /CUHK/SHB123]$ date Sat Feb 18 13:00:00 HKT 2012."— Presentation transcript:

1 HKOI 2012 TRAINING INTRO TO LINUX [waihon @ /CUHK/SHB123]$ date Sat Feb 18 13:00:00 HKT 2012

2 If you are now in Windows now, Please reboot into Linux =)

3 TODAY CONTENT Part 1 – Hello Linux World Part 2 – Shell & Command Part 3 – Using Linux

4 PART 1 – HELLO WORLD

5 LINUX FILE SYSTEM HIERARCHY “Where is my C:\Program Files and D:\ ?” /bin: system.exe (C:\Windows\System32) /boot: kernal image for booting /dev: devices file /etc: configuration files /home: home directory for users (C:\Users) /usr: user program (“Program Files”) /lib,lib64: library (“.dll” in Windows) /sbin: admin.exe (eg. ifconfig) /var: log files

6 LINUX FILE SYSTEM HIERARCHY “Where is my D:\ ???” Depend on how you “mount” your partition… You can find the devices at /dev/sdx: if your computer can find the device You can access the partition from /media: if the partition is a removable drive /home : if you mount your partition as /home

7 PART 2 – SHELL & COMMAND

8 SELF-LEARNING COMMANDS man – reference manuals man cmd: read the manual page of cmd

9 SELF-LEARNING COMMANDS whatis, whereis whatis cmd: display the man page descriptions of cmd whereis cmd: locate the cmd

10 BASIC COMMANDS ls - list directory content ls -a: list all file ls -l: long list format

11 BASIC COMMANDS cd – change directory cd: go to the my home directory cd ~: go to the my home directory cd /: go to the root directory cd dir_name: Enter dir_name cd -: Enter the previous directory cd..: Enter the parent directory

12 BASIC COMMANDS cp – copy files and directories cp fileA fileB: copy fileA to fileB cp –r dirA dirB: copy dirA to dirB recursively cp *.txt dirA/: copy all.txt file to dirA

13 BASIC COMMANDS rm – remove files or directories rm fileA: remove fileA rm –r dirA: remove dirA recursively (rmdir) rm *.out: remove all.out files

14 BASIC COMMANDS mkdir – make directories mkdir dirA: make directory dirA mkdir –p dirA/dirB: make directory dirA/dirB even if the parent directory “dirA” is not exist

15 BASIC COMMANDS rmdir – remove empty directory mkdir dirA: make directory dirA mkdir –p dirA/dirB: make directory dirA/dirB even if the parent directory “dirA” is not exist

16 BASIC COMMANDS cat – concatenate files and print cat fileA: print fileA cat fileA fileB: print fileA fileB

17 BASIC COMMANDS ps – list of current processes ps -e : Get ALL processes ps –U user: Get the user’s processes

18 BASIC COMMANDS kill – send a signal to a process kill -9 12345: send a KILL signal to process 12345

19 BASIC COMMANDS killall – kill all process by name killall a.out: kill all process with name a.out

20 MORE BASIC COMMANDS man and try them more: view file less: view file (better than more) date: show the system time uptime: tell how long the system has been running top: display Linux task find: find file seq: print sequence of number file: determine the file type head: output the first part of the file tail: output the last part of the file ……

21 USEFUL COMMANDS IN OI bc – arbitrary PRECISION calculator scale = x: set the number of digits after the decimal point in the expression

22 USEFUL COMMANDS IN OI bc – arbitrary PRECISION calculator

23 USEFUL COMMANDS IN OI factor – factorize numbers factor integer in [ 0, 2 64 )

24 USEFUL COMMANDS IN OI time – run programs and summarize system resource usage

25 USEFUL COMMANDS IN OI diff – compare files line by line diff fileA fileB: compare fileA and fileB diff –i fileA fileB: ignore case

26 USEFUL COMMANDS IN OI grep – print matching pattern ps -e | grep “firefox” : find the pattern “firefox” from the output of “ps –e” cat output.txt | grep “debug” : find if the output.txt contain pattern “debug”

27 USEFUL COMMANDS IN OI sort – sort lines of text files sort -r: reverse the result -n: numeric sort

28 TEXT EDITOR vim

29 TEXT EDITOR vim - basic [Esc]-> [normal mode] move cursor only i-> [insert mode] eg. editing ok :-> [command line mode] eg. save file Example: :w-> save file :wq-> save file and quit vim :q-> quit vim (fail if the file is edited) :q!-> quit vim without saving :wq!-> save file and quit vim!

30 TEXT EDITOR vim - basic /ptn-> search for the pattern “ptn” :123-> go to line 123 dd-> cut the line yy-> copy the line p-> paste u-> undo Ctrl+r-> redo

31 TEXT EDITOR vim – cheat sheet

32 TEXT EDITOR vim –.vimrc Locate at the home directory (~/.vimrc) Storing the personal setting of vim Sample :

33 TEXT EDITOR gedit

34 TEXT EDITOR gedit - feature nu showmatch ts=4 ……

35 COMPILER gcc/g++ g++ source.cpp [–o output] [-O2] …

36 COMPILER gcc/g++ - make Use make to avoid overwriting the source code.

37 COMPILER fpc – Free Pascal Compiler fpc source.pas –o output./output (Sorry, I have not installed pascal on my Linux)

38 PART 3 – USING LINUX

39 CHOOSING DISTRIBUTION Distro Watch : http://distrowatch.com/http://distrowatch.com/

40 CHOOSING DISTRIBUTION Linux Mint Beginners Desktop Live Medium

41 CHOOSING DISTRIBUTION Ubuntu Beginners Desktop Server Live Medium Netbooks

42 CHOOSING DISTRIBUTION fedora Desktop Server Live Medium

43 CHOOSING DISTRIBUTION fedora Desktop Server

44 3 WAYS OF INSTALLING LINUX 1) Format the partition and install 2) Virtualize 1) VirtualBox 2) VMware 3) Wubi – install Linux as a software in Windows

45 RECOMMENDATION CommandLineFu - http://www.commandlinefu.com/http://www.commandlinefu.com/ Interesting Command


Download ppt "HKOI 2012 TRAINING INTRO TO LINUX /CUHK/SHB123]$ date Sat Feb 18 13:00:00 HKT 2012."

Similar presentations


Ads by Google