Copying files [root]# cp source.txt destination.txt [root]# cp me126* /home/me12 [root]# cp -f source.txt destination.txt --> overwrites if existing [root]# cp -i source.txt destination.txt --> inform before overwriting [root]# cp -u source.txt destination.txt --> updates if newer file [root]# cp -r DIR1/ DIR2/ --> recursive copy, including sub-directories Copying file securely from local to remote server using Linux scp Username: alexm Source......(Server A): 10.152.2.11 /home/alexm/export/file.txt Destination (Server B): 10.152.2.10 /home/alexm/import/ [root]# scp /home/alexm/export/files.txt alexm@10.152.2.11:/home/alexm/import --> local to remote [root]# scp -R /home/alexm/export alexm@10.152.2.11:/home/alexm/import --> local directory to remote [root]# scp -R alexm@10.152.2.11:/home/alexm/import /home/alexm/export --> remote to local [root]# scp alexm@192.168.0.104:file1.txt alexm@192.168.0.105:mydir ----> remote to remote Copying file securely from local to and from remote server using Putty's pscp.exe c:\>util\pscp.exe alexm@192.168.0.104:/etc/hosts c:\temp\example-hosts.txt --> remote to local c:\>util\pscp.exe c:\documents\foo.txt alexm@example.com:/tmp/foo ----------> local to remote c:\>util\pscp.exe c:\documents\*.doc alexm@example.com:docfiles ------> multiple files to remote c:\>util\pscp.exe alexm@example.com:source/*.c c:\source ---------> multiple files from remote Moving/Renaming files [root]# mv source.txt destination.txt [root]# mv -R source destination ----------> copy folder recursively [root]# mv -f source.txt destination.txt --> force overwrites [root]# mv -i source.txt destination.txt --> inform before overwriting [root]# mv me126* /home/me12 --> move rsync files [root]# UPDATE LATER !!! Deleting files [root]# rm -Rf temp/ --> delete directory [root]# rm -i mytext.txt [root]# rm -d /usr/home/temp --> delete directory [root]# rm -r /usr/home/temp --> delete directory recursive Make/Delete directory [root]# mkdir -p /home/azm/temp [root]# mkdir -m 755 /home/azm/temp [root]# rmdir -p /home/azm/temp Touch files [root]# touch blank.txt View files [root]# cat readme.txt [root]# head readme.txt [root]# head -n15 readme.txt --> view first 15 lines [root]# tail readme.txt [root]# tail -n22 readme.txt --> view last 22 lines [root]# less -10 readme.txt --> view last 10 lines [root]# more readme.txt [root]# cat address | awk `{print $1, $2}' [root]# vi +/myword test.txt --> go to line having "myword" [root]# vi +3 test.txt --> go to line 3 [root]# lsof -i -f | grep 80 --> list open files Disk usage [root]# du --> disk usage [root]# df -TH --> free disk space [root]# fdisk -l --> list all partitions [root]# lvs --> list volume space [root]# lvm --> goto lvm command prompt You can also install a UI based program called "mc" or Midnight Commander, to use GUI based file management [root]# apt-get install mc [root]# dnf install mc
Tuesday, December 23, 2008
Copy, move, rename, view and delete files and disk info
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment