Download presentation
Presentation is loading. Please wait.
1
Linux Files
2
Files and directories As in Windows directories are structures which contain –Other directories –Files
3
Root directory Base directory –All others are contained within this directory Not to be confuse with /root –This is the home directory of the root user
4
Typical directories /etcconfiguration /varfiles that change (vary) such as logs /homestructure containing user homedirectories /binexecutables /sbinroot user executables /usrregular user files /tmp /root /boot /devused to access hardware resources /libsystem libraries
5
Shell Command line environment –Like the Windows “DOS command line” Prompt displayed –Enter a command and bit [enter] Result (if any) returned, and next prompt displayed Or.. Error message
6
Commands pwd –print working directory cd –change directory mkdir rmdir ls touch
7
cd cd name –changes to the name directory uses relative and absolute names one dot refers to current directory two dots refers to parent directory forward slash ( / ) indicates a directory name no slash indicates a subdirectory in the current directory
8
ls lists the names of files in a directory ls –l –long listing
9
touch updates the time stamp of a file to that time creates a new file (0 bytes) if the file does not exist
10
cp copy cp file1 file2
11
rm remove rm file1 no “undelete” –file is not placed into a ‘recycle’ bin as in Windows
12
mv move mv file1 file2 can be used to rename a file –move it to a file with a different name
13
file displays the type of file file myfilename can be used to determine if the file is an executable or a “text” file which can be displayed using cat, more or less
14
cat views the contents of a file will scroll off the screen –use the “ | “ (pipe) to the more command cat | more displays a screen, then stops spacebar will bring up next screen enter key brings up next line ctrl-x will exit the cat command
15
zcat “cats” a compressed file to the screen
16
less displays a screen at a time –use “Q” to exit –pageUp and pageDown as well as arrow keys can navigate the file
17
more displays a screen at a time
18
Filenames Length can be 256 characters upper or lower case peridos, numbers, punctuation marks –NO SLASHES!
19
File Properties ls test -rwxr-xr-x 1 cmalinow users 1839423 Apr 1 15:12 test permissions –user, group, other user group timestamp size
20
File Properties ls test -rwxr-xr-x 1 cmalinow users 1839423 Apr 1 15:12 test first character indicates type -regular file ddirectory user permissionrwx group permission “other” permission
21
Changing owner chown username.groupname filename –chown cmalinow.faculty testfileA command is invoked by root
22
chmod Changes permissions assigned to the file or directory –used by root –uses “g”, “u”, or “o” for group, user and other chmod o+w test –allows “other” to write to file chmod g=rw test –allows the group to read and write
23
chmod read, write and execute assigned –4, 2, 1 respectively chmod 640 test –user has “6”4 and 2 (read and write) –group has “4”(read) –others have “0”no access
24
File permissions When creating a file, permission are assigned umask determines the permissions to assign umask 022 –same pattern as permission in chmod –umask executed as part of logging in
25
What’s a “sticky bit”? Dilemma –depending on permissions set, any user in the group might be able to delete a file of another group member –setting the sticky bit on a directory only allows the owner, the directory owner, or root to rename or delete the file set the sticky bit by chmod 1nnn –1 indicates to put a sticky bit on the directory chmod 1777 mydir ls –ld mydir drwxrwxrwxt2 cmalinow faculty … etc… “t” indicates the ‘sticky bit’ is on
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.