/etc/default/grub
getconf LONG_BIT
64
https://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Data/endian.html
In big endian, you store the most significant byte(MSB) in the smallest address.
In little endian, you store the least significant byte(LSB) in the smallest address.
lscpu | egrep 'Byte Order'
Byte Order: Little Endian
file /bin/ps # LSB for Little Endian
/bin/ps: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.26, BuildID[sha1]=50e7d32ac155ae75537703a8df299bc72388978e, stripped
netstat -antp
dd if=/dev/urandom of=50MB.bin bs=1M count=50
ls --help | grep -E '[-][tr]\b'
-r, --reverse reverse order while sorting extension -X, size -S, time -t, version -v -t sort by modification time, newest first
service nginx status
/etc/init.d/nginx status
[....] nginx is running7[ ok 8. [....] nginx is running7[ ok 8.
update-rc.d
update-rc.d: using dependency based boot sequencing update-rc.d: error: not enough arguments usage: update-rc.d [-n] [-f] <basename> remove update-rc.d [-n] <basename> defaults [NN | SS KK] update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] . update-rc.d [-n] <basename> disable|enable [S|2|3|4|5] -n: not really -f: force The disable|enable API is not stable and might change in the future.
echo 'CentOS'
chkconfig nginx on
chkconfig nginx
export count=2
ps aux --sort=-pcpu | head -n $count
ps aux --sort=-rss | head -n $count
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND mongodb 6934 0.3 1.4 107824 11084 ? Sl Aug09 46:43 /usr/bin/mongod --unixSocketPrefix=/var/run/mongodb --config /etc/mongodb.conf run USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 23154 0.0 6.9 224388 53196 ? Sl Aug10 10:15 /root/anaconda3/envs/py35/bin/python /root/anaconda3/envs/py35/bin/jupyter-notebook --certfile=.ssh/la1.tracert.win/cert1.pem --keyfile .ssh/la1.tracert.win/privkey1.pem --notebook-dir=/root/
ssh root@10.2.3.6 'racadm serveraction powerup'
find /home -iname tecmint.txt
export http_proxy=http://192.168.4.10:7778/
export https_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,192.168.*.*,10.*.*.*"
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
echo 'ubuntu set apt-get proxy'
cat /etc/apt/apt.conf
#Acquire::http::Proxy "http://Username:Password@proxy.foo.bar.edu.au:8080";
bash: In: command not found 127
# detect proxy type
nmap -sV -p5201 127.0.0.1
set -h
bash: set: --: invalid option set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
curl -H 'Authorization: token INSERT_ACCESS_TOKEN_HERE' \
-H 'Accept: application/vnd.github.v3.raw' -O -L \
https://api.github.com/repos/owner/repo/contents/path
echo $TERM
xterm
netstat -lntup | grep sshd
tcp 0 0 0.0.0.0:10220 0.0.0.0:* LISTEN 3289/sshd tcp6 0 0 :::10220 :::* LISTEN 3289/sshd
ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 56:00:00:2d:da:d9 brd ff:ff:ff:ff:ff:ff inet 108.61.217.233/24 brd 255.255.255.0 scope global eth0 inet6 fe80::5400:ff:fe2d:dad9/64 scope link valid_lft forever preferred_lft forever
ip route
default via 108.61.217.1 dev eth0 10.99.0.0/16 dev eth1 proto kernel scope link src 10.99.0.10 108.61.217.0/24 dev eth0 proto kernel scope link src 108.61.217.233 169.254.169.254 via 108.61.217.1 dev eth0
parted -s /dev/vdb mklabel gpt
parted -s /dev/vdb unit mib mkpart primary 0% 100%
mkfs.ext4 /dev/vdb1
mkdir /mnt/data
echo >> /etc/fstab
echo /dev/vdb1 /mnt/data ext4 defaults,noatime 0 0 >> /etc/fstab
mount /mnt/data
mount -o loop,ro CentOS-7-x86_64-Everything-1511.iso /mnt/CentOS
mount.nfs nfs_server:/dir /dir
mount -tnfs4 -ominorversion=1 server_nfs_4.1:/dir
%%bash
cd ~
ls -l
date
cat py35.yml
total 24 drwxr-xr-x 12 root root 4096 Aug 10 10:02 anaconda3 drwxr-xr-x 3 root root 4096 Aug 9 18:23 btsync drwxr-xr-x 2 root root 4096 Aug 9 13:45 certbot drwx------ 7 root root 4096 Aug 9 17:34 Dropbox -rw-r--r-- 1 root root 0 Aug 10 10:06 py35.yml drwxr-xr-x 3 root root 4096 Jul 22 04:47 serverspeeder drwxr-xr-x 2 root root 4096 Jul 22 05:19 ss-libev -rw-r--r-- 1 root root 0 Aug 10 06:24 testfile lrwxrwxrwx 1 root root 21 Jul 22 06:25 www -> /usr/share/nginx/www/ Wed Aug 10 10:08:18 UTC 2016
h = !cat .bash_history
','.join([s.split('install ')[1] for s in h if 'apt-get install' in s])
'nginx,sudo,btsync,bc,shadowsocks-libev,aria2,unifi_sysvinit_all,unifi,-f unifi,-f unifi,-f'
%%bash
ps --help all | grep rss
-y do not show flags, show rss (only with -l)
mkdir -p /not/existing/folder
cd ~
cat py35.yml | head -n 4
sed -i 's/(?<=name: )root/py352/' py35.yml
cat py35.yml | head -n 4
name: root dependencies: - _nb_ext_conf=0.2.0=py35_0 - alabaster=0.7.8=py35_0 http://unix.stackexchange.com/questions/112023/how-can-i-replace-a-string-in-a-files
# http://tldp.org/LDP/abs/html/quotingvar.html
List="one two three"
for a in $List # Splits the variable in parts at whitespace.
do
echo "$a"
done
for a in "$List" # Preserves whitespace in a single variable.
do # ^ ^
echo "$a"
echo "${a}"
done
# one two three
one two three one two three one two three
a="zero zoo"
if [ $a == z* ]
then
echo '1'
fi
if [[ $a == z* ]]
then
echo '2'
fi
bash: [: too many arguments 2
string="1:2:3"
set -f # avoid globbing (expansion of *).
array=(${string//:/ })
for i in "${!array[@]}"
do
echo "$i=>${array[i]}"
done
0=>1 1=>2 2=>3
echo 'ps grep excluding grep pid'
RESULT_ssh_agent =`ps -aux | sed -n /[s]sh-agent/p`
if [ "${RESULT_ssh_agent:-null}" = null ]; then
chmod 600 /home/fzinfz/.ssh/id_rsa_vultr
eval $(ssh-agent -s)
ssh-add /home/fzinfz/.ssh/id_rsa_vultr
else
echo "ssh-agent running,skip adding"
fi
apt-get install git,aria2
E: Unable to locate package git,aria2
dpkg --get-selections | grep postgres
rsync -aP /root/_bin root@remote:/root
rsync -aP -e "ssh -p 10220" /root/data/docker-config root@remote:/root --remove-source-files
rsync --help | grep -E '[-][ezaPrlptgoDv]\b|partial|progress|sparse'
-v, --verbose increase verbosity -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X) --no-OPTION turn off an implied OPTION (e.g. --no-D) -r, --recursive recurse into directories -l, --links copy symlinks as symlinks -p, --perms preserve permissions -o, --owner preserve owner (super-user only) -g, --group preserve group -D same as --devices --specials -t, --times preserve modification times -S, --sparse handle sparse files efficiently -e, --rsh=COMMAND specify the remote shell to use --partial keep partially transferred files --partial-dir=DIR put a partially transferred file into DIR -z, --compress compress file data during the transfer --progress show progress during transfer -P same as --partial --progress
tar -zcvf new.tar.gz directory-name
tar -ztvf my-data.tar.gz
tar -tvf my-data.tar.gz
tar -tvf my-data.tar.gz '*.py'
tar -zxvf toExtract.tar.gz
gunzip file.gz
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
~/.dropbox-dist/dropboxd
Killed
deploying Let's Encrypt certificates: https://certbot.eff.org/
./certbot-auto certonly --webroot -w /usr/share/nginx/www/ -d example.com -d www.example.com
/etc/letsencrypt/live/example.com/ -> /etc/letsencrypt/archive/example.com/
cert.pem chain.pem fullchain.pem privkey.pem -> cert1.pem chain1.pem fullchain1.pem privkey1.pem
apt-get install qemu-system
qemu-system-aarch64 qemu-system-m68k qemu-system-mipsel qemu-system-s390x qemu-system-unicore32
qemu-system-alpha qemu-system-microblaze qemu-system-moxie qemu-system-sh4 qemu-system-x86_64
qemu-system-arm qemu-system-microblazeel qemu-system-or32 qemu-system-sh4eb qemu-system-x86_64-spice
qemu-system-cris qemu-system-mips qemu-system-ppc qemu-system-sparc qemu-system-xtensa
qemu-system-i386 qemu-system-mips64 qemu-system-ppc64 qemu-system-sparc64 qemu-system-xtensaeb
qemu-system-lm32 qemu-system-mips64el qemu-system-ppcemb qemu-system-tricore