Moving, Copying and Deleting files in Linux OS Environment/Bash Scripting hold key importance, these basic tasks are widely performed in Linux/Unix environments. Following are some important linux commands, which will help you in performing 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 useful commands will be helpful.
Contact Us for News Tips, Corrections and Feedback