przejście do zawartości
Jan Kończak
Narzędzia użytkownika
Zaloguj
Narzędzia witryny
Narzędzia
Pokaż stronę
Poprzednie wersje
Odnośniki
Ostatnie zmiany
Menadżer multimediów
Indeks
Zaloguj
Ostatnie zmiany
Menadżer multimediów
Indeks
Jesteś tutaj:
start
»
so
»
files_basics
»
examples
so:files_basics:examples
Ta strona jest tylko do odczytu. Możesz wyświetlić źródła tej strony ale nie możesz ich zmienić.
==== mkdir_rmdir ==== <html><pre style="line-height: 1em"> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -Al total 0 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mkdir notes/2025/04 mkdir: cannot create directory ‘notes/2025/04’: No such file or directory <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mkdir notes notes/2025 notes/2025/04 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree <span style="font-weight:bold;color:#5c5cff;">.</span> └── <span style="font-weight:bold;color:#5c5cff;">notes</span> └── <span style="font-weight:bold;color:#5c5cff;">2025</span> └── <span style="font-weight:bold;color:#5c5cff;">04</span> 4 directories, 0 files <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mkdir -p projects/2025/04 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree <span style="font-weight:bold;color:#5c5cff;">.</span> ├── <span style="font-weight:bold;color:#5c5cff;">notes</span> │ └── <span style="font-weight:bold;color:#5c5cff;">2025</span> │ └── <span style="font-weight:bold;color:#5c5cff;">04</span> └── <span style="font-weight:bold;color:#5c5cff;">projects</span> └── <span style="font-weight:bold;color:#5c5cff;">2025</span> └── <span style="font-weight:bold;color:#5c5cff;">04</span> 7 directories, 0 files <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> touch file <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mkdir file projects/2024/03 mkdir: cannot create directory ‘file’: File exists mkdir: cannot create directory ‘projects/2024/03’: No such file or directory <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mkdir -p file projects/2024/03 mkdir: cannot create directory ‘file’: File exists <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree <span style="font-weight:bold;color:#5c5cff;">.</span> ├── file ├── <span style="font-weight:bold;color:#5c5cff;">notes</span> │ └── <span style="font-weight:bold;color:#5c5cff;">2025</span> │ └── <span style="font-weight:bold;color:#5c5cff;">04</span> └── <span style="font-weight:bold;color:#5c5cff;">projects</span> ├── <span style="font-weight:bold;color:#5c5cff;">2024</span> │ └── <span style="font-weight:bold;color:#5c5cff;">03</span> └── <span style="font-weight:bold;color:#5c5cff;">2025</span> ├── <span style="font-weight:bold;color:#5c5cff;">04</span> └── <span style="font-weight:bold;color:#5c5cff;">05</span> 10 directories, 1 file <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rmdir notes/2025/04 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rmdir notes rmdir: failed to remove 'notes': Directory not empty <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree <span style="font-weight:bold;color:#5c5cff;">.</span> ├── file ├── <span style="font-weight:bold;color:#5c5cff;">notes</span> │ └── <span style="font-weight:bold;color:#5c5cff;">2025</span> └── <span style="font-weight:bold;color:#5c5cff;">projects</span> ├── <span style="font-weight:bold;color:#5c5cff;">2024</span> │ └── <span style="font-weight:bold;color:#5c5cff;">03</span> └── <span style="font-weight:bold;color:#5c5cff;">2025</span> ├── <span style="font-weight:bold;color:#5c5cff;">04</span> └── <span style="font-weight:bold;color:#5c5cff;">05</span> 9 directories, 1 file <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rmdir -p notes/2025 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree <span style="font-weight:bold;color:#5c5cff;">.</span> ├── file └── <span style="font-weight:bold;color:#5c5cff;">projects</span> ├── <span style="font-weight:bold;color:#5c5cff;">2024</span> │ └── <span style="font-weight:bold;color:#5c5cff;">03</span> └── <span style="font-weight:bold;color:#5c5cff;">2025</span> ├── <span style="font-weight:bold;color:#5c5cff;">04</span> └── <span style="font-weight:bold;color:#5c5cff;">05</span> 7 directories, 1 file <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> </pre></html> ==== ln ==== <html><pre style="line-height: 1em"> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -il * 15466639 -rw-r--r-- 1 user users 55 Apr 6 00:00 text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ln text hardlink <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ln -s text symlink <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -il * 15466639 -rw-r--r-- 2 user users 55 Apr 6 00:00 hardlink 15466649 lrwxrwxrwx 1 user users 4 Apr 6 01:00 <span style="font-weight:bold;color:#00ffff;">symlink</span> -> text 15466639 -rw-r--r-- 2 user users 55 Apr 6 00:00 text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cat text One day a tortoise will learn how to fly. (Small Gods) <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> fortune -s >> hardlink <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -il * 15466639 -rw-r--r-- 2 user users 183 Apr 6 01:00 hardlink 15466649 lrwxrwxrwx 1 user users 4 Apr 6 01:00 <span style="font-weight:bold;color:#00ffff;">symlink</span> -> text 15466639 -rw-r--r-- 2 user users 183 Apr 6 01:00 text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cat text One day a tortoise will learn how to fly. (Small Gods) "Real stupidity beats artificial intelligence every time." -- Bursar 1 - Hex 0 (Terry Pratchett, Hogfather) <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -il * 15466639 -rw-r--r-- 1 user users 183 Apr 6 01:00 hardlink 15466649 lrwxrwxrwx 1 user users 4 Apr 6 01:00 <span style="font-weight:bold;text-decoration:blink;color:#7f7f7f;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;background-color:#cd0000;">symlink</span> -> <span style="font-weight:bold;text-decoration:blink;color:#7f7f7f;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;background-color:#cd0000;">text</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mkdir text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -dil * 15466639 -rw-r--r-- 1 user users 183 Apr 6 01:00 hardlink 15466649 lrwxrwxrwx 1 user users 4 Apr 6 01:00 <span style="font-weight:bold;color:#00ffff;">symlink</span> -> <span style="font-weight:bold;color:#5c5cff;">text</span> 15466650 drwxr-xr-x 2 user users 4096 Apr 6 01:00 <span style="font-weight:bold;color:#5c5cff;">text</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ln text oh_no ln: text: hard link not allowed for directory <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ln -s whatever broken <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ln -s .. text/back <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -dil * text/* 15466651 lrwxrwxrwx 1 user users 8 Apr 6 01:00 <span style="font-weight:bold;text-decoration:blink;color:#7f7f7f;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;background-color:#cd0000;">broken</span> -> <span style="font-weight:bold;text-decoration:blink;color:#7f7f7f;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;background-color:#cd0000;">whatever</span> 15466639 -rw-r--r-- 1 user users 183 Apr 6 01:00 hardlink 15466649 lrwxrwxrwx 1 user users 4 Apr 6 01:00 <span style="font-weight:bold;color:#00ffff;">symlink</span> -> <span style="font-weight:bold;color:#5c5cff;">text</span> 15466650 drwxr-xr-x 2 user users 4096 Apr 6 01:00 <span style="font-weight:bold;color:#5c5cff;">text</span> 15466652 lrwxrwxrwx 1 user users 2 Apr 6 01:00 <span style="font-weight:bold;color:#00ffff;">text/back</span> -> <span style="font-weight:bold;color:#5c5cff;">..</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cd text/back <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~/text/back $</span> cd symlink/back <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~/text/back/symlink/back $</span> cd text/back <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~/text/back/symlink/back/text/back $</span> pwd /home/user/text/back/symlink/back/text/back <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~/text/back/symlink/back/text/back $</span> readlink -f . /home/user <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~/text/back/symlink/back/text/back $</span> realpath . /home/user <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~/text/back/symlink/back/text/back $</span> date > now <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~/text/back/symlink/back/text/back $</span> ln now hardlink text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~/text/back/symlink/back/text/back $</span> tree <span style="font-weight:bold;color:#5c5cff;">.</span> ├── <span style="font-weight:bold;text-decoration:blink;color:#7f7f7f;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;background-color:#cd0000;">broken</span> -> <span style="font-weight:bold;text-decoration:blink;color:#7f7f7f;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;"></span><span style="font-weight:bold;text-decoration:blink;color:#ffffff;background-color:#cd0000;">whatever</span> ├── hardlink ├── now ├── <span style="font-weight:bold;color:#00ffff;">symlink</span> -> <span style="font-weight:bold;color:#5c5cff;">text</span> └── <span style="font-weight:bold;color:#5c5cff;">text</span> ├── <span style="font-weight:bold;color:#00ffff;">back</span> -> <span style="font-weight:bold;color:#5c5cff;">..</span> ├── hardlink └── now </pre></html> ==== cp_mv ==== <html><pre style="line-height: 1em"> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree --noreport <span style="font-weight:bold;color:#5c5cff;">.</span> ├── date ├── <span style="font-weight:bold;color:#5c5cff;">dir</span> │ ├── file │ └── now └── text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cp text normalcopy <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cp -a text archivecopy <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -l text *copy -rw-rw---- 1 user wheel 55 Apr 6 01:00 archivecopy -rw-r----- 1 user users 55 Apr 6 02:00 normalcopy -rw-rw---- 1 user wheel 55 Apr 6 01:00 text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cp -a date text copy cp: target 'copy': No such file or directory <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mkdir copy <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cp -a date text copy <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cp copy recursive cp: -r not specified; omitting directory 'copy' <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cp -r copy recursive <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree -Dgp --noreport recursive [drwxr-xr-x users Apr 6 02:00] <span style="font-weight:bold;color:#5c5cff;">recursive</span> ├── [-rw-r--r-- users Apr 6 02:00] date └── [-rw-r----- users Apr 6 02:00] text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cp -a copy archive <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree -Dgp --noreport archive [drwxr-xr-x users Apr 6 02:00] <span style="font-weight:bold;color:#5c5cff;">archive</span> ├── [-rw-r--r-- users Apr 6 01:00] date └── [-rw-rw---- wheel Apr 6 01:00] text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cp archive/date archive/text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> cp -i archive/date archive/text cp: overwrite 'archive/text'? yes <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls <span style="font-weight:bold;color:#5c5cff;">archive</span> archivecopy <span style="font-weight:bold;color:#5c5cff;">copy</span> date <span style="font-weight:bold;color:#5c5cff;">dir</span> normalcopy <span style="font-weight:bold;color:#5c5cff;">recursive</span> text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mv normalcopy text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls <span style="font-weight:bold;color:#5c5cff;">archive</span> archivecopy <span style="font-weight:bold;color:#5c5cff;">copy</span> date <span style="font-weight:bold;color:#5c5cff;">dir</span> <span style="font-weight:bold;color:#5c5cff;">recursive</span> text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mv -i archivecopy text mv: overwrite 'text'? yes <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mv text archivecopy <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mv archivecopy date dir <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree -Dgp --noreport [drwxr-xr-x users Apr 6 02:00] <span style="font-weight:bold;color:#5c5cff;">.</span> ├── [drwxr-xr-x users Apr 6 02:00] <span style="font-weight:bold;color:#5c5cff;">archive</span> │ ├── [-rw-r--r-- users Apr 6 01:00] date │ └── [-rw-rw---- wheel Apr 6 02:00] text ├── [drwxr-xr-x users Apr 6 02:00] <span style="font-weight:bold;color:#5c5cff;">copy</span> │ ├── [-rw-r--r-- users Apr 6 01:00] date │ └── [-rw-rw---- wheel Apr 6 01:00] text ├── [drwxr-xr-x users Apr 6 02:00] <span style="font-weight:bold;color:#5c5cff;">dir</span> │ ├── [-rw-rw---- wheel Apr 6 01:00] archivecopy │ ├── [-rw-r--r-- users Apr 6 01:00] date │ ├── [-rw-rw---- wheel Apr 6 01:00] file │ └── [-rw-r--r-- users Apr 6 01:00] now └── [drwxr-xr-x users Apr 6 02:00] <span style="font-weight:bold;color:#5c5cff;">recursive</span> ├── [-rw-r--r-- users Apr 6 02:00] date └── [-rw-r----- users Apr 6 02:00] text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> mv dir copy <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> tree --noreport <span style="font-weight:bold;color:#5c5cff;">.</span> ├── <span style="font-weight:bold;color:#5c5cff;">archive</span> │ ├── date │ └── text ├── <span style="font-weight:bold;color:#5c5cff;">copy</span> │ ├── date │ ├── <span style="font-weight:bold;color:#5c5cff;">dir</span> │ │ ├── archivecopy │ │ ├── date │ │ ├── file │ │ └── now │ └── text └── <span style="font-weight:bold;color:#5c5cff;">recursive</span> ├── date └── text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> </pre></html> ==== scp_sftp ==== <html><pre style="line-height: 1em"> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> whoami user <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls date <span style="font-weight:bold;color:#5c5cff;">dir</span> text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> scp example.com:myScript.pl scriptFromExample.pl user@example.com's password: myScript.pl 100% 85 80.2KB/s 00:00 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls date <span style="font-weight:bold;color:#5c5cff;">dir</span> <span style="font-weight:bold;color:#00ff00;">scriptFromExample.pl</span> text <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> scp user@example.com:myScript.pl . user@example.com's password: myScript.pl 100% 85 84.4KB/s 00:00 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> scp john@example.com:todo.txt . john@example.com's password: todo.txt 100% 50 49.3KB/s 00:00 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls date <span style="font-weight:bold;color:#5c5cff;">dir</span> <span style="font-weight:bold;color:#00ff00;">myScript.pl</span> <span style="font-weight:bold;color:#00ff00;">scriptFromExample.pl</span> text <span style="color:#00cd00;">todo.txt</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> scp todo.txt user@mylaptop:/tmp/johns_todo.txt user@mylaptop's password: todo.txt 100% 50 75.5KB/s 00:00 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> scp text user@example.com: user@example.com's password: text 100% 30 49.2KB/s 00:00 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> scp dir example.com: user@example.com's password: scp: local "dir" is not a regular file scp: failed to upload file dir to . <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> scp -r dir example.com: user@example.com's password: file 100% 55 94.1KB/s 00:00 now 100% 30 115.4KB/s 00:00 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> scp john@example.com:photos/cat.jpg \ > john@example.com:photos/ghoti.jpg \ > user@mylaptop:/tmp/johns_todo.txt \ > user@example.com: user@example.com's password: john@example.com's password: cat.jpg 100% 100KB 26.8MB/s 00:00 john@example.com's password: ghoti.jpg 100% 236KB 31.8MB/s 00:00 user@mylaptop's password: johns_todo.txt 100% 50 47.2KB/s 00:00 <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> sftp john@example.com john@example.com's password: Connected to example.com. sftp> pwd Remote working directory: /home/john sftp> ls documents photos todo.txt sftp> lpwd Local working directory: /home/user sftp> lls date dir myScript.pl scriptFromExample.pl text todo.txt sftp> put myScript.pl userScript.pl Uploading myScript.pl to /home/john/userScript.pl myScript.pl 100% 85 137.0KB/s 00:00 sftp> put dir/file Uploading dir/file to /home/john/file file 100% 55 89.4KB/s 00:00 sftp> lcd dir sftp> lpwd Local working directory: /home/user/dir sftp> get todo.txt new_todo.txt Fetching /home/john/todo.txt to new_todo.txt todo.txt 100% 50 77.3KB/s 00:00 sftp> get photos Fetching /home/john/photos/ to photos download /home/john/photos/: not a regular file sftp> get -r photos Fetching /home/john/photos/ to photos Retrieving /home/john/photos ghoti.jpg 100% 236KB 45.1MB/s 00:00 cat.jpg 100% 100KB 43.4MB/s 00:00 sftp> cd /tmp sftp> pwd Remote working directory: /tmp sftp> ls sftp> put -r dir/* Uploading dir/file to /tmp/file file 100% 55 72.3KB/s 00:00 Uploading dir/new_todo.txt to /tmp/new_todo.txt new_todo.txt 100% 50 219.8KB/s 00:00 Uploading dir/now to /tmp/now now 100% 30 160.8KB/s 00:00 Uploading dir/photos/ to /tmp/photos Entering dir/photos/ cat.jpg 100% 100KB 27.8MB/s 00:00 ghoti.jpg 100% 236KB 39.2MB/s 00:00 sftp> ls -l -rw-r----- ? john john 55 Apr 6 02:00 file -rw-r--r-- ? john john 50 Apr 6 02:00 new_todo.txt -rw-r--r-- ? john john 30 Apr 6 02:00 now drwxr-xr-x ? john john 4096 Apr 6 02:00 photos sftp> lls -l total 16 -rw-rw---- 1 user wheel 55 Apr 6 01:00 file -rw-r--r-- 1 user users 50 Apr 6 02:00 new_todo.txt -rw-r--r-- 1 user users 30 Apr 6 01:00 now drwxr-xr-x 2 user users 4096 Apr 6 02:00 photos sftp> quit <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> </pre></html> ==== rm ==== <html><pre style="line-height: 1em"> <span style="opacity:0.50"><span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -lt total 44 drwxr-xr-x 3 user users 4096 Apr 7 19:34 <span style="font-weight:bold;color:#5c5cff;">misc</span> drwxr-xr-x 2 user users 4096 Apr 6 02:00 <span style="font-weight:bold;color:#5c5cff;">photos</span> -rw-r--r-- 1 user users 30 Apr 6 02:00 <span style="color:#00cd00;">normalfile.txt</span> -r--r--r-- 1 user wheel 30 Apr 6 02:00 <span style="color:#00cd00;">readonlyfile.txt</span> -rw-r--r-- 1 user users 165 Apr 6 02:00 <span style="color:#00cd00;">input-1.txt</span> -rw-r--r-- 1 user users 139 Apr 6 02:00 <span style="color:#00cd00;">input-2.txt</span> -rw-r--r-- 1 user users 85 Apr 6 02:00 data1.csv -rw-r--r-- 1 user users 50 Apr 6 02:00 data2.csv -rw-r--r-- 1 user users 125 Apr 6 02:00 data3.csv -rw-r--r-- 1 user users 100 Apr 6 02:00 data4.csv -rw-r--r-- 1 user users 200 Apr 6 02:00 data5.csv</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm normalfile.txt <span style="opacity:0.50"><span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -t <span style="font-weight:bold;color:#5c5cff;">misc</span> <span style="color:#00cd00;">readonlyfile.txt</span> <span style="color:#00cd00;">input-2.txt</span> data2.csv data4.csv <span style="font-weight:bold;color:#5c5cff;">photos</span> <span style="color:#00cd00;">input-1.txt</span> data1.csv data3.csv data5.csv</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm readonlyfile.txt rm: remove write-protected regular file 'readonlyfile.txt'? <span style="opacity:0.50"><span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -t <span style="font-weight:bold;color:#5c5cff;">misc</span> <span style="color:#00cd00;">readonlyfile.txt</span> <span style="color:#00cd00;">input-2.txt</span> data2.csv data4.csv <span style="font-weight:bold;color:#5c5cff;">photos</span> <span style="color:#00cd00;">input-1.txt</span> data1.csv data3.csv data5.csv</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm -f readonlyfile.txt <span style="opacity:0.50"><span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -t <span style="font-weight:bold;color:#5c5cff;">misc</span> <span style="color:#00cd00;">input-1.txt</span> data1.csv data3.csv data5.csv <span style="font-weight:bold;color:#5c5cff;">photos</span> <span style="color:#00cd00;">input-2.txt</span> data2.csv data4.csv</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm normalfile.txt rm: cannot remove 'normalfile.txt': No such file or directory <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm -f normalfile.txt <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm photos rm: cannot remove 'photos': Is a directory <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm -r photos <span style="opacity:0.50"><span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -t <span style="font-weight:bold;color:#5c5cff;">misc</span> <span style="color:#00cd00;">input-2.txt</span> data2.csv data4.csv <span style="color:#00cd00;">input-1.txt</span> data1.csv data3.csv data5.csv <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -ld misc/rootsDir misc/rootsDir/data drwxr-xr-x 2 root root 4096 Apr 7 19:33 <span style="font-weight:bold;color:#5c5cff;">misc/rootsDir</span> -rw-r--r-- 1 user users 50 Apr 6 02:00 misc/rootsDir/data</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm misc/rootsDir/data rm: cannot remove 'misc/rootsDir/data': Permission denied <span style="opacity:0.50"><span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls misc file now <span style="font-weight:bold;color:#5c5cff;">rootsDir</span></span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm -r misc rm: descend into write-protected directory 'misc/rootsDir'? y rm: cannot remove 'misc/rootsDir/data': Permission denied <span style="opacity:0.50"><span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls misc <span style="font-weight:bold;color:#5c5cff;">rootsDir</span> </span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm input-1.txt input-2.txt <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm -i data*.csv rm: remove regular file 'data1.csv'? rm: remove regular file 'data2.csv'? rm: remove regular file 'data3.csv'? ^C <span style="opacity:0.50"><span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -t <span style="font-weight:bold;color:#5c5cff;">misc</span> data1.csv data2.csv data3.csv data4.csv data5.csv</span> <span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> rm -I data*.csv rm: remove 5 arguments? y <span style="opacity:0.50"><span style="font-weight:bold;color:#00ff00;">user@host</span><span style="font-weight:bold;color:#5c5cff;"> ~ $</span> ls -t <span style="font-weight:bold;color:#5c5cff;">misc</span></span> </pre></html>
so/files_basics/examples.txt
· ostatnio zmienione: 2025/04/07 19:49 przez
jkonczak
Narzędzia strony
Pokaż stronę
Poprzednie wersje
Odnośniki
Złóż / rozłóż wszystko
Do góry