Creating text files
touch file1 file2 file3 # One/more empty file create
echo “Test” > redirect_output # redirect the echo outputcat file1 file2 file3 > conc_file # concatenate file1,file2,file3 into conc_file
Remove the files
rm file1 # remove single file file1
rm file1 file2 # remove mulitiple file file1, file2
rm * # remove all the files from current directory(keep in mind it will delete all the files from present directory)
delete options
rm -i file1 # get user suggestion before delete the file
rm -rf file1/directory # it will delete files/directories without any suggestion
rm -i file1 # get user suggestion before delete the file
rm -rf file1/directory # it will delete files/directories without any suggestion
Create & Remove the hidden files
Before file name put l(dot) is used to create hidden files.It should be displayed using the option ls -a
Creating / Deleting a directory
Syntax: mkdir dir_name
rmdir dir_name # remove the empty dir only
rm –rf dir_name # remove the non empty directory
rmdir dir_name # remove the empty dir only
rm –rf dir_name # remove the non empty directory
Changing directory
cd [pathname]
cd # return home directory
cd - # return to the previous working directory
cd .. # change to previous directory
pwd # display the path name of the working
cd # return home directory
cd - # return to the previous working directory
cd .. # change to previous directory
pwd # display the path name of the working
No comments:
Post a Comment