/l3/users/slm/2018-12-minsk-aws/instructor.BigClassRoom/user :1 :2 |
|
$su
root@instructor:/home/user# exit exit |
$screen
|
$ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 30:85:a9:9e:10:aa brd ff:ff:ff:ff:ff:ff inet 172.20.13.183/25 brd 172.20.13.255 scope global dynamic enp3s0 valid_lft 690907sec preferred_lft 690907sec inet6 fe80::3285:a9ff:fe9e:10aa/64 scope link valid_lft forever preferred_lft forever |
$l
bash: l: command not found |
$scpu
bash: scpu: command not found |
$llscpu
bash: llscpu: command not found |
$lscpu
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel ... CPU max MHz: 6300.0000 CPU min MHz: 1600.0000 BogoMIPS: 7005.07 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 6144K NUMA node0 CPU(s): 0-3 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm epb ka |
$ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 30:85:a9:9e:10:aa brd ff:ff:ff:ff:ff:ff inet 172.20.13.183/25 brd 172.20.13.255 scope global dynamic enp3s0 valid_lft 690658sec preferred_lft 690658sec inet6 fe80::3285:a9ff:fe9e:10aa/64 scope link valid_lft forever preferred_lft forever |
$free
total used free shared buff/cache available Mem: 7868220 618724 6655852 81480 593644 6931948 Swap: 8072188 0 8072188 |
$ls -l /proc/cpuinfo
-r--r--r-- 1 root root 0 Dec 17 12:26 /proc/cpuinfo |
$less /proc/cpuinfo
|
$less /proc/cpuinfo
|
$grep vmxdfssdfds /proc/cpuinfo
|
$lscpu | less -R
|
$free
total used free shared buff/cache available Mem: 7868220 617624 6658016 79940 592580 6934580 Swap: 8072188 0 8072188 |
$lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller (rev 09) 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09) 00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09) 00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) 00:16.0 Communication controller: Intel Corporation 7 Series/C216 Chipset Family MEI Controller #1 (rev 04) 00:1a.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04) 00:1b.0 Audio device: Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04) 00:1c.0 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 1 (rev c4) 00:1c.4 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 5 (rev c4) 00:1c.5 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c4) 00:1d.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04) 00:1f.0 ISA bridge: Intel Corporation Z77 Express Chipset LPC Controller (rev 04) 00:1f.2 SATA controller: Intel Corporation 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04) 00:1f.3 SMBus: Intel Corporation 7 Series/C216 Chipset Family SMBus Controller (rev 04) 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06) 04:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge (rev 03) |
$lspci | less -R
|
$00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DR
|
$lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller (rev 09) 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09) 00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09) 00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) 00:16.0 Communication controller: Intel Corporation 7 Series/C216 Chipset Family MEI Controller #1 (rev 04) 00:1a.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04) 00:1b.0 Audio device: Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04) 00:1c.0 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 1 (rev c4) 00:1c.4 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 5 (rev c4) 00:1c.5 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c4) 00:1d.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04) 00:1f.0 ISA bridge: Intel Corporation Z77 Express Chipset LPC Controller (rev 04) 00:1f.2 SATA controller: Intel Corporation 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04) 00:1f.3 SMBus: Intel Corporation 7 Series/C216 Chipset Family SMBus Controller (rev 04) 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06) 04:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge (rev 03) |
$lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller (rev 09) 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09) 00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09) 00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) 00:16.0 Communication controller: Intel Corporation 7 Series/C216 Chipset Family MEI Controller #1 (rev 04) 00:1a.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04) 00:1b.0 Audio device: Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04) 00:1c.0 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 1 (rev c4) 00:1c.4 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 5 (rev c4) 00:1c.5 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c4) 00:1d.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04) 00:1f.0 ISA bridge: Intel Corporation Z77 Express Chipset LPC Controller (rev 04) 00:1f.2 SATA controller: Intel Corporation 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04) 00:1f.3 SMBus: Intel Corporation 7 Series/C216 Chipset Family SMBus Controller (rev 04) 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06) 04:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge (rev 03) |
$dmidecode
bash: dmidecode: command not found |
$su
Password: su: Authentication failure |
$su
Password: root@instructor:/home/user# root@instructor:/home/user# root@instructor:/home/user# sudo sudo sudoedit sudoreplay root@instructor:/home/user# vim /etc/sudoers sudoers sudoers.d/ root@instructor:/home/user# vim /etc/sudoers sudoers sudoers.d/ root@instructor:/home/user# vim /etc/sudoers ... # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL user ALL=(ALL:ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: "/etc/sudoers" 28L, 695C written root@instructor:/home/user# exit exit |
$sudo apt-get install dmidecode
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for user: Reading package lists... Done Building dependency tree Reading state information... Done dmidecode is already the newest version (3.0-4). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. |
$. /etc/bash_completio
bash: /etc/bash_completio: No such file or directory |
$. /etc/bash_completion
|
$sudo
Display all 2389 possibilities? (y or n) |
$vim ~/.bashrc
|
$vim ~/.bashrc
|
$sudo dmidecode
# dmidecode 3.0 Getting SMBIOS data from sysfs. SMBIOS 2.7 present. 107 structures occupying 3724 bytes. Table at 0x000EB410. Handle 0x0000, DMI type 0, 24 bytes BIOS Information Vendor: American Megatrends Inc. Version: 0801 Release Date: 07/17/2012 ... Resolution: Unknown Handle 0x0069, DMI type 19, 31 bytes Memory Array Mapped Address Starting Address: 0x00000000000 Ending Address: 0x001FFFFFFFF Range Size: 8 GB Physical Array Handle: 0x005F Partition Width: 4 Handle 0x006C, DMI type 127, 4 bytes End Of Table |
$sudo dmidecode | less -R
|
$grep bash_completion ~/.bashrc
. /etc/bash_completion |
$sudo apt-get install hdparm
Reading package lists... Done Building dependency tree Reading state information... Done hdparm is already the newest version (9.51+ds-1+deb9u1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. |
$cat /proc/partitions
major minor #blocks name 8 0 625131864 sda 8 1 617057280 sda1 8 2 1 sda2 8 5 8072192 sda5 11 0 1048575 sr0 |
$dmesg | grep sda
dmesg: read kernel buffer failed: Operation not permitted |
$sudo dmesg | grep sda
[ 0.964291] sd 4:0:0:0: [sda] 1250263728 512-byte logical blocks: (640 GB/596 GiB) [ 0.964329] sd 4:0:0:0: [sda] Write Protect is off [ 0.964332] sd 4:0:0:0: [sda] Mode Sense: 00 3a 00 00 [ 0.964349] sd 4:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 1.064209] sda: sda1 sda2 < sda5 > [ 1.065051] sd 4:0:0:0: [sda] Attached SCSI disk [ 1.898897] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null) [ 5.468073] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro [ 12.643692] Adding 8072188k swap on /dev/sda5. Priority:-1 extents:1 across:8072188k FS |
$cat /proc/partitions
major minor #blocks name 8 0 625131864 sda 8 1 617057280 sda1 8 2 1 sda2 8 5 8072192 sda5 11 0 1048575 sr0 |
$df -h
Filesystem Size Used Avail Use% Mounted on udev 3.8G 0 3.8G 0% /dev tmpfs 769M 18M 751M 3% /run /dev/sda1 579G 4.3G 545G 1% / tmpfs 3.8G 12K 3.8G 1% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup tmpfs 769M 16K 769M 1% /run/user/117 tmpfs 769M 36K 769M 1% /run/user/1001 tmpfs 769M 0 769M 0% /run/user/0 |
$mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) udev on /dev type devtmpfs (rw,nosuid,relatime,size=3922840k,nr_inodes=980710,mode=755) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=786824k,mode=755) /dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered) securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) ... cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=37,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=536) mqueue on /dev/mqueue type mqueue (rw,relatime) debugfs on /sys/kernel/debug type debugfs (rw,relatime) hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime) tmpfs on /run/user/117 type tmpfs (rw,nosuid,nodev,relatime,size=786820k,mode=700,uid=117,gid=122) tmpfs on /run/user/1001 type tmpfs (rw,nosuid,nodev,relatime,size=786820k,mode=700,uid=1001,gid=1001) fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime) gvfsd-fuse on /run/user/1001/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1001,group_id=1001) tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=786820k,mode=700) |
$sudo hdparm -tT /dev/sda
/dev/sda: Timing cached reads: 26816 MB in 1.99 seconds = 13447.17 MB/sec Timing buffered disk reads: 246 MB in 3.01 seconds = 81.76 MB/sec |
$apt-cache search bonnie
bonnie++ - Hard drive benchmark suite |
$sudo apt-get install bonnie++
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: bonnie++ 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 61.4 kB of archives. After this operation, 187 kB of additional disk space will be used. Get:1 http://ftp.by.debian.org/debian stretch/main amd64 bonnie++ amd64 1.97.3 [61.4 kB] Fetched 61.4 kB in 0s (696 kB/s) Selecting previously unselected package bonnie++. (Reading database ... 138607 files and directories currently installed.) Preparing to unpack .../bonnie++_1.97.3_amd64.deb ... Unpacking bonnie++ (1.97.3) ... Setting up bonnie++ (1.97.3) ... Processing triggers for man-db (2.7.6.1-2) ... |
$sudo bonnie++ -d /tmp -s 4G -n 0 -m TEST -f -b -u user
Using uid:1001, gid:1001. File size should be double RAM for good results, RAM is 7680M. usage: bonnie++ [-d scratch-dir] [-c concurrency] [-s size(MiB)[:chunk-size(b)]] [-n number-to-stat[:max-size[:min-size][:num-directories[:chunk-size]]]] [-m machine-name] [-r ram-size-in-MiB] [-x number-of-tests] [-u uid-to-use:gid-to-use] [-g gid-to-use] [-q] [-f] [-b] [-p processes | -y] [-z seed | -Z random-file] [-D] Version: 1.97 |
$sudo bonnie++ -d /tmp -s 1500M -n 0 -m TEST -f -b -u user
Using uid:1001, gid:1001. File size should be double RAM for good results, RAM is 7680M. usage: bonnie++ [-d scratch-dir] [-c concurrency] [-s size(MiB)[:chunk-size(b)]] [-n number-to-stat[:max-size[:min-size][:num-directories[:chunk-size]]]] [-m machine-name] [-r ram-size-in-MiB] [-x number-of-tests] [-u uid-to-use:gid-to-use] [-g gid-to-use] [-q] [-f] [-b] [-p processes | -y] [-z seed | -Z random-file] [-D] Version: 1.97 |
$sudo bonnie++ -d /tmp -s 1600M -n 0 -m TEST -f -b -u user
Using uid:1001, gid:1001. File size should be double RAM for good results, RAM is 7680M. usage: bonnie++ [-d scratch-dir] [-c concurrency] [-s size(MiB)[:chunk-size(b)]] [-n number-to-stat[:max-size[:min-size][:num-directories[:chunk-size]]]] [-m machine-name] [-r ram-size-in-MiB] [-x number-of-tests] [-u uid-to-use:gid-to-use] [-g gid-to-use] [-q] [-f] [-b] [-p processes | -y] [-z seed | -Z random-file] [-D] Version: 1.97 |
$sudo bonnie++ -d /tmp -s 16000M -n 0 -m TEST -f -b -u user
Using uid:1001, gid:1001. Writing intelligently...done Rewriting...done Reading intelligently...done start 'em...done...done...done...done...done... Version 1.97 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP TEST 16000M 80742 7 13087 1 81731 6 112.1 2 Latency 750ms 1881ms 126ms 648ms 1.97,1.97,TEST,1,1545043950,16000M,,,,80742,7,13087,1,,,81731,6,112.1,2,,,,,,,,,,,,,,,,,,,750ms,1881ms,,126ms,648ms,,,,,, |
$curl rate.sx/btc
▶ Bitcoin (BTC) ▶ Sun 16 +1d +0.12% │ 3310.0 │ ⡇ ⡇ │ ⡇ ⢸ ⡇ │ ⡇ ⢸⡰⡀ ⢰⡇ │ ⡇ ⢸⠃⡇ ⣼⡇ │ ⡇ ⢸ ⢇ ⡇⡇ │ ⡇ ⢸ ⢸ ⡇⡇ │ ⡇ ⡎ ⠘⡄ ⡇⢱ │ ⡇⢨⠁ ⡇ ⠠⠃⢸⢠⡆ ⣦ ... │ ⠈ ⢸ ⢸⣄ ⡇ ⡇ ⡄⡜ ⠁ │ ⢸ ⡜⠈⠚⡄⢸ ⢣⡆⡷⠁ │ ⢸⡼⣾ ⢇⣸ ⢿ │ ⠃ ⢸⠘ ⠈ │ 3250.0 └──────────────────────────────────────────────────────────────────────────────── begin: $3282.0 (Sun 16 11:30) // end: $3286.0 (Mon 17 11:25) high: $3308.2 (Mon 17 08:15) // low: $3252.0 (Mon 17 00:00) avg: $3274.1 // median: $3280.1 // change: +3.9954 (+0.12%) Use @ for interval specification: /btc@10d, /eth@4w, /xrp@January (more in /:help) |
$sudo apt-get install curl
[sudo] password for user: Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libcurl3 The following NEW packages will be installed: curl libcurl3 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 519 kB of archives. ... (Reading database ... 138626 files and directories currently installed.) Preparing to unpack .../libcurl3_7.52.1-5+deb9u8_amd64.deb ... Unpacking libcurl3:amd64 (7.52.1-5+deb9u8) ... Selecting previously unselected package curl. Preparing to unpack .../curl_7.52.1-5+deb9u8_amd64.deb ... Unpacking curl (7.52.1-5+deb9u8) ... Setting up libcurl3:amd64 (7.52.1-5+deb9u8) ... Processing triggers for libc-bin (2.24-11+deb9u3) ... Processing triggers for man-db (2.7.6.1-2) ... Setting up curl (7.52.1-5+deb9u8) ... |
$nc
nc ncal nc.traditional |
$curl cheat.sh/ls
# Displays everything in the target directory ls path/to/the/target/directory # Displays everything including hidden files ls -a # Displays all files, along with the size (with unit suffixes) and timestamp ls -lh # Display files, sorted by size ls -S # Display directories only ls -d */ # Display directories only, include hidden ls -d .*/ */ |
$curl cheat.sh/df
# Printout disk free space in a human readable format df -h # Disk free space for ext2 file systems df -t ext2 # Disk free space for file systems except ext2 df -x ext2 # Show inode usage df -i # Show information about a distinct file system /path df /path |
$curl cheat.sh/df,?T
# Printout disk free space in a human readable format df -h # Disk free space for ext2 file systems df -t ext2 # Disk free space for file systems except ext2 df -x ext2 # Show inode usage df -i # Show information about a distinct file system /path df /path |
$curl cheat.sh/df?T
# Printout disk free space in a human readable format df -h # Disk free space for ext2 file systems df -t ext2 # Disk free space for file systems except ext2 df -x ext2 # Show inode usage df -i # Show information about a distinct file system /path df /path |
$curl cheat.sh/python/create+file?T
# linux - open() in Python does not create a file if it doesn't ... # # You should use file = open('myfile.dat', 'w+') # # [muksie] [so/q/2967194] [cc by-sa 3.0] |
$curl cheat.sh/python/remove+file?T
# python - How to delete a file or folder # # os.remove() (http://docs.python.org/library/os.htmlos.remove) will # remove a file. # # os.rmdir() (http://docs.python.org/library/os.htmlos.rmdir) will # remove an empty directory. # # shutil.rmtree() # (http://docs.python.org/library/shutil.htmlshutil.rmtree) will delete # a directory and all its contents. # # [RichieHindle] [so/q/6996603] [cc by-sa 3.0] |
$curl cheat.sh/python/parse+json?T
# python - Parsing values from a JSON file? # # I think what Ignacio is saying is that your JSON file is incorrect. # You have [] when you should have {}. [] are for lists, {} are for # dictionaries. # # Here's how your JSON file should look, your JSON file wouldn't even # load for me: { "maps": [ ... with open('data.json') as f: data = json.load(f) pprint(data) # With data, you can now also find values like so: data["maps"][0]["id"] data["masks"]["id"] data["om_points"] # Try those out and see if it starts to make sense. # # [Justin Peel] [so/q/2835559] [cc by-sa 3.0] |
$wget -Oq- cheat.sh/python/parse+json?T
--2018-12-17 14:19:56-- http://cheat.sh/python/parse+json?T Resolving cheat.sh (cheat.sh)... 5.9.243.188 Connecting to cheat.sh (cheat.sh)|5.9.243.188|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 964 [text/plain] Saving to: ‘q-’ q- 100%[===================>] 964 --.-KB/s in 0s 2018-12-17 14:19:56 (283 MB/s) - ‘q-’ saved [964/964] |
$wget -qO- cheat.sh/python/parse+json?T
# python - Parsing values from a JSON file? # # I think what Ignacio is saying is that your JSON file is incorrect. # You have [] when you should have {}. [] are for lists, {} are for # dictionaries. # # Here's how your JSON file should look, your JSON file wouldn't even # load for me: { "maps": [ ... with open('data.json') as f: data = json.load(f) pprint(data) # With data, you can now also find values like so: data["maps"][0]["id"] data["masks"]["id"] data["om_points"] # Try those out and see if it starts to make sense. # # [Justin Peel] [so/q/2835559] [cc by-sa 3.0] |
$curl wttr.in
Weather report: Minsk, Belarus Overcast .--. -12--5 °C .-( ). ← 22 km/h (___.__)__) 7 km 0.3 mm ┌─────────────┐ ┌──────────────────────────────┬───────────────────────┤ Mon 17 Dec ├───────────────────────┬──────────────────────────────┐ │ Morning │ Noon └──────┬──────┘ Evening │ Night │ ├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤ ... ┌──────────────────────────────┬───────────────────────┤ Wed 19 Dec ├───────────────────────┬──────────────────────────────┐ │ Morning │ Noon └──────┬──────┘ Evening │ Night │ ├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤ │ _`/"".-. Light snow │ _`/"".-. Light snow │ Mist │ Freezing fog │ │ ,\_( ). -9--7 °C │ ,\_( ). -8--6 °C │ _ - _ - _ - -11--9 °C │ _ - _ - _ - -14--12 °C │ │ /(___(__) ↖ 5-8 km/h │ /(___(__) ↖ 5-7 km/h │ _ - _ - _ ← 4-8 km/h │ _ - _ - _ ← 6-12 km/h │ │ * * * 20 km │ * * * 20 km │ _ - _ - _ - 20 km │ _ - _ - _ - 20 km │ │ * * * 0.0 mm | 0% │ * * * 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │ └──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘ Follow @igor_chubin for wttr.in updates |
$curl wttr.in?2n
Weather report: Minsk, Belarus Overcast .--. -12--5 °C .-( ). ← 22 km/h (___.__)__) 7 km 0.3 mm ┌─────────────┐ ┌───────────────────────┤ Mon 17 Dec ├───────────────────────┐ │ Noon └──────┬──────┘ Night │ ├──────────────────────────────┼──────────────────────────────┤ ... ┌───────────────────────┤ Tue 18 Dec ├───────────────────────┐ │ Noon └──────┬──────┘ Night │ ├──────────────────────────────┼──────────────────────────────┤ │ .-. Moderate snow │ Freezing fog │ │ ( ). -9--6 °C │ _ - _ - _ - -10 °C │ │ (___(__) ↖ 8-10 km/h │ _ - _ - _ ↑ 5-8 km/h │ │ * * * * 12 km │ _ - _ - _ - 15 km │ │ * * * * 0.1 mm | 0% │ 0.0 mm | 0% │ └──────────────────────────────┴──────────────────────────────┘ Follow @igor_chubin for wttr.in updates |
$curl be.wttr.in?2n | less -R
|
$й
bash: й: command not found |
$curl qrenco.de/
Append the string that you want to encode to qrenco.de/ in the URL or pipe the string into curl -F $ printf "two\nlines" \ $ curl qrenco.de/this | curl -F-=\<- qrenco.de █████████████████████████████ █████████████████████████████ █████████████████████████████ █████████████████████████████ ████ ▄▄▄▄▄ █▀ █ ▄█ ▄▄▄▄▄ ████ ████ ▄▄▄▄▄ ███▄█ █ ▄▄▄▄▄ ████ ████ █ █ █▄ █▀▄█ █ █ ████ ████ █ █ █▄█▄█▀█ █ █ ████ ████ █▄▄▄█ █ ██▀ █ █▄▄▄█ ████ ████ █▄▄▄█ ██ ▀ ▄█ █▄▄▄█ ████ ████▄▄▄▄▄▄▄█ ▀ ▀ █▄▄▄▄▄▄▄████ ████▄▄▄▄▄▄▄█ █ █▄█▄▄▄▄▄▄▄████ ████ ▄█ ▀▀▄▄▀▄▄███ ▄▄▀ ▀████ ████ ▄ █▄ ▄ ▀▄▀▄▄▄▀▀█▄█▀████ ████ █▄ ▀█▄▄ █▄▀▄▄███▀▄▀ ████ ████▀ ██▀ ▄█ ▄█ ▀▄▄ ▄█ ▄████ █████████▄▄█▀ ▀▄█▄▀ ▀▀ ████ ████▄█▄▄█▄▄█▀█▀▄█ █ ▀█▀▄ ████ ████ ▄▄▄▄▄ █▄ ▀▀ █ ▀█▄▄█████ ████ ▄▄▄▄▄ █ ▄▄█▄ █▄▄ █ ████ ████ █ █ █▀▄▀ ██▄ ▄▄█▀ ████ ████ █ █ █▄█ ▀▄▀ ▀▀▀ ▀█████ ████ █▄▄▄█ █▀█▄█▄▀▀▀▄ ██▄████ ████ █▄▄▄█ █ ▄▄ ▀▀█ ▄██▀▄████ ████▄▄▄▄▄▄▄█▄▄▄▄▄████▄▄▄█████ ████▄▄▄▄▄▄▄█▄█▄▄██▄▄███▄▄████ █████████████████████████████ █████████████████████████████ █████████████████████████████ █████████████████████████████ |
$head -3 /etc/passwd | curl -F-=\<- qrenco.de
█████████████████████████████████████████████████ █████████████████████████████████████████████████ ████ ▄▄▄▄▄ █▀ ▀ █▄ █▄ ▄▀█▀ ▄▀▄ ▀▄▄▄██ ▄▄▄▄▄ ████ ████ █ █ █▄ ██▀▄ ▄ ▄▀▄█ ███▀ ▄▄▄ ▀█ █ █ ████ ████ █▄▄▄█ █ █▄▀█▄▀█▄▄ ▀█▄█▄▀ ▀▀ █ █▄▄▄█ ████ ████▄▄▄▄▄▄▄█ █ █ █▄█▄▀ █▄▀ █▄█ █▄▀ █▄█▄▄▄▄▄▄▄████ ████ ▄█ ▀█▄ █ ▀▄ ▄▄▄▀██▄▀▄▀▄ ▄ ▄ ▀█▄ █ ▄█ ▀████ ████▀ ▄▄▄█▄▀▄█▄█ █▀█ ▄▄ ▀▀▀▀▀ ▄█ ▄▄▄██▄█▄█▀▄█████ ████ █ █▄▄▀▀▄▀█▀█ ▀█▄▀ ▄▀▄▀▄█▄ ▄ ▀ ▄██ ▀▀█████ ████▄▄█ ▀▄ ▀▄ █▀▀▀█▀▀█ ▀▄▄▀ ▀█▄▀▀██▀▀██▀▄▄ ████ ... ████ ▀ ▀█▀▄██ ▀▄█▄▄██████ ▀ ▀ █▀█▀▄▀▀▀▀ ▄█▄▄ ████ █████▀ █ ▀▄ █ ███▄▀▀▄▀██▄ ▄▀▀█ ▄▀ ▄▄ ▀▀████▀████ ████▄█▄▄█ ▄▀▄ ▄▀█▄▄▀▀ ▄█ ▀▄██▄▄▀▀ ▄██▄██ ▀█ ▄████ ████▄█▄▄█▄▄█▀█▄▄▀ ██▀▀▄▄▄▄ ▄ ▄▄▄ █▄▄ ▄▄▄ ▀ ▄ ████ ████ ▄▄▄▄▄ █▄ ▄█▀ ▄▀ █ ▀ ▄██▀███▄▄█ █▄█ ▄▀████ ████ █ █ █▀▄█▀ ▀ ▀▄█ ▀ ▄▀█▀▄▀█▄▄█▀ ▄ ▄ ▀▄█████ ████ █▄▄▄█ █▀▀██ ▄ ▀▀█ ▄ ▀▀▄█▄▀▀ ▀█ ▄▄ ▄████ ████▄▄▄▄▄▄▄█▄▄█▄███▄▄▄███▄██▄████▄██▄█▄██▄█▄█████ █████████████████████████████████████████████████ █████████████████████████████████████████████████ |
$cat 1.json
[ { "name": "Vladislav", "hostname" "m4", }, { "name": "Vladmir", "hostname" "m5", } ] |
$sudo apt-get install jq
[sudo] password for user: Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libjq1 libonig4 The following NEW packages will be installed: jq libjq1 libonig4 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 327 kB of archives. ... Preparing to unpack .../libjq1_1.5+dfsg-1.3_amd64.deb ... Unpacking libjq1:amd64 (1.5+dfsg-1.3) ... Selecting previously unselected package jq. Preparing to unpack .../jq_1.5+dfsg-1.3_amd64.deb ... Unpacking jq (1.5+dfsg-1.3) ... Setting up libonig4:amd64 (6.1.3-2) ... Setting up libjq1:amd64 (1.5+dfsg-1.3) ... Processing triggers for libc-bin (2.24-11+deb9u3) ... Processing triggers for man-db (2.7.6.1-2) ... Setting up jq (1.5+dfsg-1.3) ... |
$vim 1.json
|
$cat 1.json | jq
[ { "name": "Vladislav", "hostname": "m4" }, { "name": "Vladmir", "hostname": "m5" } ] |
$cat 1.json | jq .[1]
{ "name": "Vladmir", "hostname": "m5" } |
$cat 1.json | jq .[1].name
"Vladmir" |
$cat 1.json | jq -r .[1].name
Vladmir |
$cat github.txt
chubin |
$vim github.txt
|
$git clone https://github.com/sl-2018-12/aws
Cloning into 'aws'... Username for 'https://github.com': ^C |
$ls
1.json Documents github.txt Pictures q- Videos Desktop Downloads Music Public Templates |
$ls
1.json Desktop Downloads Music Public Templates aws Documents github.txt Pictures q- Videos |
$cd aws
|
$ls
LICENSE README.md |
$vim hello.md
|
$git status
On branch master Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) hello.md nothing added to commit but untracked files present (use "git add" to track) |
$cеccat hello.md
## Hello Hello *world* |
$# cd aws
|
$# vim hello.md
|
$git add hello.md
|
$git commit -m 'added hello.md' hello.md
*** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for <(null)>) not allowed |
$git config --global user.email "igor.sl@chub.in"
|
$git config --global user.name "Igor Chubin"
|
$git log
commit 040ff60c09e71afea1b862f9a9bcb28eb1fc407e Author: Igor Chubin <igor.sl@chub.in> Date: Mon Dec 17 16:13:39 2018 +0300 added hello.md commit 3701219f3c9dde1dafc94374123c603706ad8e5f Author: sl-2018-12 <45940846+sl-2018-12@users.noreply.github.com> Date: Mon Dec 17 16:04:09 2018 +0300 Initial commit |
$git push
Username for 'https://github.com': ^C |
$git status
On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean |
$git push
Username for 'https://github.com': sl-2018-12 Password for 'https://sl-2018-12@github.com': Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 325 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To https://github.com/sl-2018-12/aws 3701219..040ff60 master -> master |
$ifconfig
bash: ifconfig: command not found |
$/sbin/ifconfig
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.20.13.183 netmask 255.255.255.128 broadcast 172.20.13.255 inet6 fe80::3285:a9ff:fe9e:10aa prefixlen 64 scopeid 0x20<link> ether 30:85:a9:9e:10:aa txqueuelen 1000 (Ethernet) RX packets 144436 bytes 82262877 (78.4 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 139245 bytes 80647397 (76.9 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (Local Loopback) RX packets 6264 bytes 7336075 (6.9 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 6264 bytes 7336075 (6.9 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 |
$git pull
remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. From https://github.com/sl-2018-12/aws 040ff60..89856e9 master -> origin/master Updating 040ff60..89856e9 Fast-forward hello.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) |
$ls
hello.md LICENSE README.md |
major minor #blocks name 8 0 625131864 sda 8 1 617057280 sda1 8 2 1 sda2 8 5 8072192 sda5 11 0 1048575 sr0
[ { "name": "Vladislav", "hostname" "m4", }, { "name": "Vladmir", "hostname" "m5", } ]
chubin
Время первой команды журнала | 10:20:26 2018-12-17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Время последней команды журнала | 14:27:28 2018-12-17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в журнале | 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент команд с ненулевым кодом завершения, % | 11.00 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Процент синтаксически неверно набранных команд, % | 6.00 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Суммарное время работы с терминалом *, час | 1.99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Количество командных строк в единицу времени, команда/мин | 0.84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Частота использования команд |
|
В журнал автоматически попадают все команды, данные в любом терминале системы.
Для того чтобы убедиться, что журнал на текущем терминале ведётся, и команды записываются, дайте команду w. В поле WHAT, соответствующем текущему терминалу, должна быть указана программа script.
Команды, при наборе которых были допущены синтаксические ошибки, выводятся перечёркнутым текстом:
$ l s-l bash: l: command not found |
Если код завершения команды равен нулю, команда была выполнена без ошибок. Команды, код завершения которых отличен от нуля, выделяются цветом.
$ test 5 -lt 4 |
Команды, ход выполнения которых был прерван пользователем, выделяются цветом.
$ find / -name abc find: /home/devi-orig/.gnome2: Keine Berechtigung find: /home/devi-orig/.gnome2_private: Keine Berechtigung find: /home/devi-orig/.nautilus/metafiles: Keine Berechtigung find: /home/devi-orig/.metacity: Keine Berechtigung find: /home/devi-orig/.inkscape: Keine Berechtigung ^C |
Команды, выполненные с привилегиями суперпользователя, выделяются слева красной чертой.
# id uid=0(root) gid=0(root) Gruppen=0(root) |
Изменения, внесённые в текстовый файл с помощью редактора, запоминаются и показываются в журнале в формате ed. Строки, начинающиеся символом "<", удалены, а строки, начинающиеся символом ">" -- добавлены.
$ vi ~/.bashrc
|
Для того чтобы изменить файл в соответствии с показанными в диффшоте изменениями, можно воспользоваться командой patch. Нужно скопировать изменения, запустить программу patch, указав в качестве её аргумента файл, к которому применяются изменения, и всавить скопированный текст:
$ patch ~/.bashrc |
Для того чтобы получить краткую справочную информацию о команде, нужно подвести к ней мышь. Во всплывающей подсказке появится краткое описание команды.
Если справочная информация о команде есть, команда выделяется голубым фоном, например: vi. Если справочная информация отсутствует, команда выделяется розовым фоном, например: notepad.exe. Справочная информация может отсутствовать в том случае, если (1) команда введена неверно; (2) если распознавание команды LiLaLo выполнено неверно; (3) если информация о команде неизвестна LiLaLo. Последнее возможно для редких команд.
Большие, в особенности многострочные, всплывающие подсказки лучше всего показываются браузерами KDE Konqueror, Apple Safari и Microsoft Internet Explorer. В браузерах Mozilla и Firefox они отображаются не полностью, а вместо перевода строки выводится специальный символ.
Время ввода команды, показанное в журнале, соответствует времени начала ввода командной строки, которое равно тому моменту, когда на терминале появилось приглашение интерпретатора
Имя терминала, на котором была введена команда, показано в специальном блоке. Этот блок показывается только в том случае, если терминал текущей команды отличается от терминала предыдущей.
Вывод не интересующих вас в настоящий момент элементов журнала, таких как время, имя терминала и других, можно отключить. Для этого нужно воспользоваться формой управления журналом вверху страницы.
Небольшие комментарии к командам можно вставлять прямо из командной строки. Комментарий вводится прямо в командную строку, после символов #^ или #v. Символы ^ и v показывают направление выбора команды, к которой относится комментарий: ^ - к предыдущей, v - к следующей. Например, если в командной строке было введено:
$ whoami
user
$ #^ Интересно, кто я?в журнале это будет выглядеть так:
$ whoami
user
Интересно, кто я? |
Если комментарий содержит несколько строк, его можно вставить в журнал следующим образом:
$ whoami
user
$ cat > /dev/null #^ Интересно, кто я?
Программа whoami выводит имя пользователя, под которым мы зарегистрировались в системе. - Она не может ответить на вопрос о нашем назначении в этом мире.В журнале это будет выглядеть так:
$ whoami user
|
Комментарии, не относящиеся непосредственно ни к какой из команд, добавляются точно таким же способом, только вместо симолов #^ или #v нужно использовать символы #=
1 2 3 4Группы команд, выполненных на разных терминалах, разделяются специальной линией. Под этой линией в правом углу показано имя терминала, на котором выполнялись команды. Для того чтобы посмотреть команды только одного сенса, нужно щёкнуть по этому названию.
LiLaLo (L3) расшифровывается как Live Lab Log.
Программа разработана для повышения эффективности обучения Unix/Linux-системам.
(c) Игорь Чубин, 2004-2008