manipulating files and directory Flashcards
what is the wildcard matches any characters and the wildcard matches any single character
- and ?
wildcard that matches any character that is a member of the set characters or not the member or of the specified class
[characters] [!characters] [[:class:]]
character classes
alphanumberic [:alnum:] alphabetic [:alpha:] numeral [:digit:] lowercase letter [:lower:] uppercase letter [:upper:]
what is the wildcard of any file beginning with either an ‘a’, ‘b’ or ‘c’
[abc]*
what is the wildcard of any file beginning with ‘back’ follow by three numerals
back[:digit:][:digit:][:digit:]
what is the wildcard of any file ending with lowercase letter or numeral ‘1’ or ‘2’
*[[:lower:]12]
how to create directory ‘dir1’
mkdir dir1
how to create multi directory ‘dir1’,’dir2’and’dir3’
mkdir dir1 dir2 dir3
how to copy a file or directory ‘item1’ to file or directory ‘item2’
cp item1 item2
how to copy multiple items ‘item1’ ‘item2’ ‘item3’ to a directory ‘items’
cp item1 item2 item3 items
how to copy files and directories with all of their attributes including ownerships and permission
cp -a
how to set a confirmation before overwriting an existing file when coping the files
cp -i
how to recursively copy directories itself and their content
cp -r
how to display informative messages as the copy is performed
cp -v
how to copy file only when that file either dont exist or are newer than the existing corresponding files in the destination directory
cp -u
how to copy all the file in dir1 but not dir1 itself to dir2 where dir2 must alr exist
cp dir1/* dir2
how to copy the all content of directory dir1 to dir2 and dir2 can does not exist
cp -r dir1 dir2
how to rename a file ‘item1’ to ‘item2’
mv item1 item2
how to move files ‘item1’ ‘item2’ to ‘dir1’
mv item1 item2 dir1
confirmation of move
mv -i
moving files from one directory to another, only move files that either dont exist or are newer than the existing corresponding files in the destination directory
mv -u
display informative messages as the move is performed
mv -v
move ‘dir1’ and its content to ‘dir2’ where dir2 can be exist or not, and dir1 is deleted
mv dir1 dir2
remove ‘item’ ‘item2’
rm item item2