Day 4
File Management
There are different ways to create a file -
vim [filename]
touch [filename]
cat > [filename]
[! when using 'cat' command, press Ctrl+D to save. '>>' to append to an existing file]
To create a directory
mkdir [directory_name]
To create multiple files using touch
touch filename{1..10}
[! this option will work with mkdir command as well]
To copy a file
cp [source_file] [target]
To copy a directory
cp -r [source_directory] [target]
To move/rename a file or directory
mv [source] [target]
mv [old_name] [new_name]
To delete a file
rm [filename]
To delete a directory
rmdir [directory_name]
[! this works only on empty directory]
rm -rf [directory_name]
[! this works even on directory with contents]
--End of Day 4--
No comments:
Post a Comment