Shell Commands
Find a file (i.e. httpd.conf)
find / -name httpd.conf
Deleting all files matching a pattern
find ./ -name ".orig" -exec rm -rf {} \;
Delete Files
rm file1 # delete a file (use -i to ask whether sure)
rm -rf dir1 # like above, but don't ask if we have a -i alias
Copy Files
cp file1 file2 # copy file1 to file2
cp file1 directory # copy file1 into directory
cp file1 file2 file3 ... directory # copy files into directory
cp -R dir1 dir2/ # copy dir1 into dir2 including subdirectries
cp -pR dir1 dir2/ # copy directory, preserving permissions
Move/Rename Files
mv # testfile testfile2
Directories
mkdir # Make directory
rm -r dir1 # delete a directory and everything in it (CARE!)
Leave a Reply
Want to join the discussion?Feel free to contribute!