cp -r /etc/passwd Pulpit
Nic się nie wyświetliło. Katalog został skopiowany pomyślnie.
more -5 /etc/passwd
Plik passwd został wyświetlony z podziałem na 5 wierszy.
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
cat tekst1 tekst2 > tekst3.txt
Przekierowanie wykonane zostało pomyślnie.
head $HOME/* -n 5 -q
head: błąd czytania „kat2b”:
Jest katalogiem
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
Dagmara Dykiert 200159,
head -n 5 /etc/passwd |tail -n 3
5 bin:x:2:2:bin:/bin:/bin/sh
6 sys:x:3:3:sys:/dev:/bin/sh
7 ync:x:4:65534:sync:/bin:/bin/sync
head -n 7 /etc/passwd |tail -n 75
7 man:x:6:12:man:/var/cache/man:/bin/sh
6 games:x:5:60:games:/usr/games:/bin/sh
5
cat /etc/passwd |tr "n" " "
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/bin/sh man:x:6:12:man:/var/cache/man:/bin/sh lp:x:7:7:lp:/var/spool/lpd:/bin/sh mail:x:8:8:mail:/var/mail:/bin/sh news:x:9:9:news:/var/spool/news:/bin/sh uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh proxy:x:13:13:proxy:/bin:/bin/sh www-data:x:33:33:www-data:/var/www:/bin/sh backup:x:34:34:backup:/var/backups:/bin/sh list:x:38:38:Mailing List Manager:/var/list:/bin/sh irc:x:39:39:ircd:/var/run/ircd:/bin/sh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh nobody:x:65534:65534:nobody:/nonexistent:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/sh syslog:x:101:103::/home/syslog:/bin/false messagebus:x:102:105::/var/run/dbus:/bin/false avahi-autoipd:x:103:108:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/bin/false avahi:x:104:109:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false usbmux:x:105:46:usbmux daemon,,,:/home/usbmux:/bin/false gdm:x:106:114:Gnome Display Manager:/var/lib/gdm:/bin/false speech-dispatcher:x:107:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/sh kernoops:x:108:65534:Kernel Oops Tracking Daemon,,,:/:/bin/false pulse:x:109:116:PulseAudio daemon,,,:/var/run/pulse:/bin/false rtkit:x:110:119:RealtimeKit,,,:/proc:/bin/false hplip:x:111:7:HPLIP system user,,,:/var/run/hplip:/bin/false saned:x:112:121::/home/saned:/bin/false labadmin:x:1000:1000:labadmin,,,:/home/labadmin:/bin/bash qnx:x:1002:1002:qnx,,,,:/home/qnx:/bin/bash android:x:1003:1003:android,,,,:/home/android:/bin/bash sshd:x:113:65534::/var/run/sshd:/usr/sbin/nologin cns1:x:1004:1004:,,,:/home/cns1:/bin/bash cns2:x:1005:1005:,,,:/home/cns2:/bin/bash fpga:x:1007:1007:,,,:/home/fpga:/bin/bash pps:x:1009:1009:,,,:/home/pps:/bin/bash colord:x:114:124:colord colour management daemon,,,:/var/lib/colord:/bin/false lightdm:x:115:126:Light Display Manager:/var/lib/lightdm:/bin/false whoopsie:x:116:127::/nonexistent:/bin/false c:x:1001:1001:,,,:/home/c:/bin/bash guest-7O01AB:x:117:129:Guest,,,:/tmp/guest-7O01AB:/bin/bash guest-IuRMJe:x:118:130:Guest,,,:/tmp/guest-IuRMJe:/bin/bash tos:x:1010
cat passwd | tr ”\n”
ls -aA1 /etc |wc -l
head -n 3 /etc/passwd | wc -c
ls | tr '[a-z]' '[A-Z]'
KAT2B
PASSWD
RAP2.TXT
RAP2.TXT~
TEKST1.TXT
TEKST2.TXT
TEKST3.TXT
. -not -type d -exec ls -l '{}' ';' |cut -d ' ' -f1,6,9
c@lab-109:~/196356$ ls -all
razem 20
drwxrwxr-x 3 c c 113 kwi 16 11:37 .
drwxr-xr-x 65 c c 4096 kwi 16 11:21 ..
drwxrwxr-x 3 c c 33 mar 19 12:41 kat2b
-rw-r--r-- 1 c c 2350 kwi 16 11:28 passwd
-rw-rw-r-- 1 c c 2605 mar 19 12:47 rap2.txt
-rw-rw-r-- 1 c c 2605 mar 19 12:46 rap2.txt~
-rw-rw-r-- 1 c c 0 kwi 16 11:37 tekst1.txt
-rw-rw-r-- 1 c c 0 kwi 16 11:37 tekst2.txt
-rw-rw-r-- 1 c c 0 kwi 16 11:37 tekst3.txt
ls -l -S
razem 12
-rw-r--r-- 1 c c 2350 kwi 16 11:28 passwd
-rw-rw-r-- 1 c c 2605 mar 19 12:46 rap2.txt~
-rw-rw-r-- 1 c c 2605 mar 19 12:47 rap2.txt
drwxrwxr-x 3 c c 33 mar 19 12:41 kat2b
-rw-rw-r-- 1 c c 0 kwi 16 11:37 tekst1.txt
-rw-rw-r-- 1 c c 0 kwi 16 11:37 tekst2.txt
-rw-rw-r-- 1 c c 0 kwi 16 11:37 tekst3.txt
sort -t : -n -k3 -r /etc/passwd
android:x:1003:1003:android,,,,:/home/android:/bin/bash
avahi-autoipd:x:103:108:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/bin/false
avahi:x:104:109:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
backup:x:34:34:backup:/var/backups:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
cns1:x:1004:1004:,,,:/home/cns1:/bin/bash
cns2:x:1005:1005:,,,:/home/cns2:/bin/bash
colord:x:114:124:colord colour management daemon,,,:/var/lib/colord:/bin/false
c:x:1001:1001:,,,:/home/c:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
fpga:x:1007:1007:,,,:/home/fpga:/bin/bash
games:x:5:60:games:/usr/games:/bin/sh
gdm:x:106:114:Gnome Display Manager:/var/lib/gdm:/bin/false
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
guest-7O01AB:x:117:129:Guest,,,:/tmp/guest-7O01AB:/bin/bash
guest-IuRMJe:x:118:130:Guest,,,:/tmp/guest-IuRMJe:/bin/bash
hplip:x:111:7:HPLIP system user,,,:/var/run/hplip:/bin/false
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
kernoops:x:108:65534:Kernel Oops Tracking Daemon,,,:/:/bin/false
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
lightdm:x:115:126:Light Display Manager:/var/lib/lightdm:/bin/false
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
messagebus:x:102:105::/var/run/dbus:/bin/false
news:x:9:9:news:/var/spool/news:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
pps:x:1009:1009:,,,:/home/pps:/bin/bash
proxy:x:13:13:proxy:/bin:/bin/sh
pulse:x:109:116:PulseAudio daemon,,,:/var/run/pulse:/bin/false
qnx:x:1002:1002:qnx,,,,:/home/qnx:/bin/bash
root:x:0:0:root:/root:/bin/bash
rtkit:x:110:119:RealtimeKit,,,:/proc:/bin/false
saned:x:112:121::/home/saned:/bin/false
speech-dispatcher:x:107:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/sh
sshd:x:113:65534::/var/run/sshd:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
syslog:x:101:103::/home/syslog:/bin/false
sys:x:3:3:sys:/dev:/bin/sh
tos:x:1010:1010:,,,:/home/tos:/bin/bash
usbmux:x:105:46:usbmux daemon,,,:/home/usbmux:/bin/false
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
vstudent:x:1006:1006:,,,:/home/vstudent:/bin/bash
whoopsie:x:116:127::/nonexistent:/bin/false
www-data:x:33:33:www-data:/var/www:/bin/sh
sort -t : -k4 -r /etc/passwd | sort -t : -k3
,
root:x:0:0:root:/root:/bin/bash
labadmin:x:1000:1000:labadmin,,,:/home/labadmin:/bin/bash
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
c:x:1001:1001:,,,:/home/c:/bin/bash
qnx:x:1002:1002:qnx,,,,:/home/qnx:/bin/bash
android:x:1003:1003:android,,,,:/home/android:/bin/bash
cns1:x:1004:1004:,,,:/home/cns1:/bin/bash
cns2:x:1005:1005:,,,:/home/cns2:/bin/bash
vstudent:x:1006:1006:,,,:/home/vstudent:/bin/bash
fpga:x:1007:1007:,,,:/home/fpga:/bin/bash
kolokwium:x:1008:1008:kolokwium,,,:/home/kolokwium:/bin/bash
pps:x:1009:1009:,,,:/home/pps:/bin/bash
tos:x:1010:1010:,,,:/home/tos:/bin/bash
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
syslog:x:101:103::/home/syslog:/bin/false
messagebus:x:102:105::/var/run/dbus:/bin/false
avahi-autoipd:x:103:108:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/bin/false
avahi:x:104:109:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
usbmux:x:105:46:usbmux daemon,,,:/home/usbmux:/bin/false
gdm:x:106:114:Gnome Display Manager:/var/lib/gdm:/bin/false
speech-dispatcher:x:107:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/sh
kernoops:x:108:65534:Kernel Oops Tracking Daemon,,,:/:/bin/false
pulse:x:109:116:PulseAudio daemon,,,:/var/run/pulse:/bin/false
rtkit:x:110:119:RealtimeKit,,,:/proc:/bin/false
hplip:x:111:7:HPLIP system user,,,:/var/run/hplip:/bin/false
saned:x:112:121::/home/saned:/bin/false
sshd:x:113:65534::/var/run/sshd:/usr/sbin/nologin
colord:x:114:124:colord colour management daemon,,,:/var/lib/colord:/bin/false
lightdm:x:115:126:Light Display Manager:/var/lib/lightdm:/bin/false
whoopsie:x:116:127::/nonexistent:/bin/false
guest-7O01AB:x:117:129:Guest,,,:/tmp/guest-7O01AB:/bin/bash
guest-IuRMJe:x:118:130:Guest,,,:/tmp/guest-IuRMJe:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
find ~ -printf '%u\n' 2>/dev/null | sort | uniq -c
15 avahi
1 avahi-autoipd
29390 c
81 cns1
5 cns2
184 colord
9 daemon
5 fpga
1 gdm
50 kolokwium
75 labadmin
2 libuuid
9 lightdm
2 lp
351 man
7 messagebus
6 nobody
120 pps
5 qnx
399995 root
10 rtkit
1 speech-dispatcher
37 syslog
6185 tos
283 vstudent
139 whoopsie
Nie potrafię.
ls -l | grep "^-" | sort -n -k5,5 | head -n 3 | sort -k9,9
-rw-rw-r-- 1 c c 0 kwi 16 11:37 tekst1.txt
-rw-rw-r-- 1 c c 0 kwi 16 11:37 tekst2.txt
-rw-rw-r-- 1 c c 0 kwi 16 11:37 tekst3.txt
du -s * | sort -nr | head -n 3
4 rap2.txt~
4 rap2.txt
4 passwd
cat /etc/passwd | cut -d: -f1,7 | grep -v '/bin/bash' | cut -d: -f1
Nie potrafię.
who | tr -s ' ' '\t' | cut -f1 | sort | uniq -c
Nie potrafię.
-->
[Author:Krzysztof]
Jednak potrzebne jest potwierdzanie działania poleceń - to przyzwoitość inżynierska i praktyka w stosowaniu
8/20