Results

See more...

[Linux TidBits] Moving, Copying, Deleting and Viewing Files

Moving, Copying, Deleting & Viewing files in Linux / Bash scripting is a necessity, these tasks are performed very commenly while working in Linux environments, following are few Linux commands to perform said tasks:

ls -l

List files in current directory using long format.

ls -F

List files in current directory and indicate the file type.

ls -laC

List all files in current directory in long format and display in columns.

rm name

Remove a file or directory called name.

rm -rf name

Kill off an entire directory and all it’s includes files and subdirectories.

cp filename /home/dirname

Copy the file called filename to the /home/dirname directory.

mv filename /home/dirname

Move the file called filename to the /home/dirname directory.

cat filetoview

Display the file called filetoview.

man -k keyword

Display man pages containing keyword.

more filetoview

Display the file called filetoview one page at a time, proceed to next page using the spacebar.

head filetoview

Display the first 10 lines of the file called filetoview.

head -20 filetoview

Display the first 20 lines of the file called filetoview.

tail filetoview

Display the last 10 lines of the file called filetoview.

tail -20 filetoview

Display the last 20 lines of the file called filetoview.

Hope these commands would be helpful.

Contact Us for News Tips, Corrections and Feedback
0 comments
Leave a message...