Create a directory: mkdir dir
Create nested directories: mkdir -p dir1/dir2
Changing directories:
cd newdir
cd .. (parent directory)
cd -(previous directory)
cd (home directory)
cd ~bill (home directory of user bill)
Print the working (current) directory: pwd
Copy a file to another: cp source_file dest_file
Copy files to a directory: cp file1 file2 dir
Copy directories recursively:
cp -r source_dir dest_dir
rsync -a source_dir/ dest_dir/
Create a symbolic link: ln -s linked_file link
Rename a file, link or directory: mv source_file dest_file
Remove files or links: rm file1 file2
Remove empty directories: rmdir dir
Remove non-empty directories: rm -rf dir
Most Popular Articles
Listing files
List all “regular” files (not starting with .) in the current directory:lsDisplay a long...
Displaying file contents
Concatenate and display file contents:cat file1 file2Display the contents of several files...
File name pattern matching
Concatenate all “regular” files: cat *Concatenate all “hidden” files: cat .*Concatenate all files...
Handling file contents
Show only the lines in a file containing a given substring: grep substring fileCase insensitive...
Commands for changing file access rights
Add write permissions to the current user:chmod u+w fileAdd read permissions to users in the file...