Download presentation
Presentation is loading. Please wait.
Published byMark Richard Modified over 9 years ago
1
Files and Directories Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See http://software-carpentry.org/license.html for more information. The Unix Shell
2
Files and DirectoriesIntroduction Communicate with each other Interact with us Run Programs Store Data
3
Files and DirectoriesIntroduction Communicate with each other Interact with us Run Programs Store Data shell
4
Files and DirectoriesIntroduction Store Data shell
5
Files and DirectoriesIntroduction Store Data shell file system
6
Files and DirectoriesIntroduction Store Data shell file system files
7
Files and DirectoriesIntroduction Store Data shell file system filesdirectories
8
Files and DirectoriesIntroduction Store Data shell file system filesdirectories Use the shell to view and change the file system
9
Files and DirectoriesIntroduction Store Data shell file system filesdirectories Use the shell to run commands to view what's in the file system
10
Files and DirectoriesIntroduction login:
11
Files and DirectoriesIntroduction login:computer prompt in bold
12
Files and DirectoriesIntroduction login:computer prompt in bold explanatory text in blue
13
Files and DirectoriesIntroduction login: vladuser input in green
14
Files and DirectoriesIntroduction login: vlad password: ******** password
15
Files and DirectoriesIntroduction login: vlad password: ******** $ shell prompt
16
Files and DirectoriesIntroduction login: vlad password: ******** $ shell prompt like Python's >>> and …
17
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami check user ID
18
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami check user ID shell finds the whoami program
19
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami check user ID shell finds the whoami program runs it
20
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad check user ID shell finds the whoami program runs it prints its output
21
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ check user ID shell finds the whoami program runs it prints its output displays a new prompt
22
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd what is the working directory
23
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd what is the working directory the directory used when no other directory is explicitly specified
24
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $
25
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ root
26
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ / root
27
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ / root
28
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ bin / root
29
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ bindata / root
30
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ bindatausers / root
31
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ bindatauserstmp / root
32
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ bindatauserstmp / root
33
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ bindatauserstmp / root imhoteplarryvlad
34
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ bindatauserstmp / root imhoteplarryvlad
35
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ bindatauserstmp / root imhoteplarryvlad
36
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ bindatauserstmp / root imhoteplarryvlad
37
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ ls stands for "listing"
38
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ ls stands for "listing" sadly more memorable than most command names
39
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ ls bin data mail music notes.txt papers pizza.cfg solar solar.pdf swc $
40
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ ls -F bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ an argument or flag modifying the command's behavior
41
Files and DirectoriesIntroduction login: vlad password: ******** $ whoami vlad $ pwd /users/vlad $ ls -F bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ adds a trailing '/' to directory names
42
Files and DirectoriesIntroduction $ ls -F bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ vlad binmusicmail papers data solar notes.txt pizza.cfg solar.pdf swc
43
Files and DirectoriesIntroduction $ ls -F bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ By convention, use filename extension to indicate file type
44
Files and DirectoriesIntroduction $ ls -F bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ By convention, use filename extension to indicate file type.txt for text,.pdf for PDF,.cfg for configuration file, etc.
45
Files and DirectoriesIntroduction $ ls -F bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ By convention, use filename extension to indicate file type.txt for text,.pdf for PDF,.cfg for configuration file, etc. But this is only a convention, not a guarantee
46
Files and DirectoriesIntroduction $ ls –F data
47
Files and DirectoriesIntroduction $ ls –F data amino_acids.txt elements/ morse.txt pdb/ planets.txt sunspot.txt $
48
Files and DirectoriesIntroduction vlad data a relative path $ ls –F data amino_acids.txt elements/ morse.txt pdb/ planets.txt sunspot.txt $
49
Files and DirectoriesIntroduction vlad data a relative path relative to current working directory $ ls –F data amino_acids.txt elements/ morse.txt pdb/ planets.txt sunspot.txt $
50
Files and DirectoriesIntroduction $ ls –F /data access.log backup/ hardware.cfg network.cfg $
51
Files and DirectoriesIntroduction an absolute path $ ls –F /data access.log backup/ hardware.cfg network.cfg $
52
Files and DirectoriesIntroduction an absolute path leading '/' means "from root" $ ls –F /data access.log backup/ hardware.cfg network.cfg $
53
Files and DirectoriesIntroduction bindatauserstmp / imhoteplarryvlad an absolute path leading '/' means "from root" so it always refers to this directory $ ls –F /data access.log backup/ hardware.cfg network.cfg $
54
Files and DirectoriesIntroduction $ pwd /users/vlad $
55
Files and DirectoriesIntroduction $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $
56
Files and DirectoriesIntroduction $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ cd data
57
Files and DirectoriesIntroduction $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ cd data change directory
58
Files and DirectoriesIntroduction change directory actually doesn't change the directory $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ cd data
59
Files and DirectoriesIntroduction change directory actually doesn't change the directory changes the shell's idea of which directory we are in $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ cd data
60
Files and DirectoriesIntroduction $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ cd data $ pwd /users/vlad/data $
61
Files and DirectoriesIntroduction $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ cd data $ pwd /users/vlad/data $ ls amino_acids.txt elements/ morse.txt pdb/ planets.txt sunspot.txt $
62
Files and DirectoriesIntroduction because we're now "in" this directory $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ cd data $ pwd /users/vlad/data $ ls amino_acids.txt elements/ morse.txt pdb/ planets.txt sunspot.txt $
63
Files and DirectoriesIntroduction $ pwd /users/vlad/data $
64
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd..
65
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd.. the directory above the current one
66
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd.. the directory above the current one its parent directory
67
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd.. $ pwd /users/vlad $
68
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd.. $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $
69
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd.. $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ ls -F -a./../ bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/
70
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd.. $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ ls -F -a./../ bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ "show all"
71
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd.. $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ ls -F -a./../ bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ parent directory
72
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd.. $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ ls -F -a./../ bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ parent directory /users
73
Files and DirectoriesIntroduction $ pwd /users/vlad/data $ cd.. $ pwd /users/vlad $ ls bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ $ ls -F -a./../ bin/ data/ mail/ music/ notes.txt papers/ pizza.cfg solar/ solar.pdf swc/ this directory itself
74
Files and DirectoriesIntroduction Things are different on Windows
75
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad
76
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Drive letter
77
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Drive letter Each drive is a separate file system
78
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Backslash \ as separator
79
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Backslash \ as separator Unix uses \ to escape special characters in names like my\ files.txt
80
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Case insensitive
81
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Case insensitive c:\users\vlad C:\USERS\VLAD C:\uSeRs\VlAd
82
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Cygwin: /cygdrive/c/Users/vlad Map drive letters to "directories"
83
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Cygwin: /cygdrive/c/Users/vlad Map drive letters to "directories" And use / instead of \
84
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Cygwin: /cygdrive/c/Users/vlad Map drive letters to "directories" And use / instead of \ But still case insensitive
85
Files and DirectoriesIntroduction Things are different on Windows C:\Users\vlad Cygwin: /cygdrive/c/Users/vlad Map drive letters to "directories" And use / instead of \ But still case insensitive Can't put backup.txt and Backup.txt in a directory
86
Files and DirectoriesIntroduction pwd print working directory cd change working directory ls listing. current directory..parent directory
87
August 2010 created by Greg Wilson Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See http://software-carpentry.org/license.html for more information.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.