User Tools

Site Tools


dev:tricks:linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dev:tricks:linux [2014/08/07 05:09] – [Add a Linux user account without password] hackerzhoudev:tricks:linux [2020/06/06 23:32] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Linux Tricks ====== ====== Linux Tricks ======
 ===== Linux Common ===== ===== Linux Common =====
 +==== XML beautiful format command ====
 +<code bash>
 +cat xxx.xml |  xmllint --format -
 +</code>
 +
 +==== Remount filesystem as read-write ====
 +<code bash>
 +mount -o rw,remount /
 +</code>
 +
 +==== Useful tools to monitor linux ====
 +<code bash>
 +iostat
 +meminfo/free
 +mpstat
 +netstat
 +nmon
 +pmap
 +ps/pstree
 +sar
 +strace
 +tcpdump
 +top
 +uptime
 +vmstat
 +wireshark
 +</code>
 +
 +==== Use ipref to test network ====
 +<code bash>
 +#UDP mode
 +#Server side
 +iperf -u -s
 +#Client side
 +iperf -u -c 192.168.1.1 -b 100M -t 60
 +#Using 30 threads with 5Mbps each
 +iperf -u -c 192.168.1.1 -b 5M -P 30 -t 60
 +#Test both download and upload bandwidth
 +iperf -u -c 192.168.1.1 -b 100M -d -t 60
 +
 +#TCP mode
 +#Server side
 +iperf -s
 +#Client side
 +iperf -c 192.168.1.1 -t 60
 +#Using 30 threads
 +iperf -c 192.168.1.1 -P 30 -t 60
 +#Test both download and upload bandwidth
 +iperf -c 192.168.1.1 -d -t 60
 +</code>
 +
 +==== Add mount --bind info in /etc/fstab ====
 +<code bash>
 +/mnt/hdd1/test /home/test/ext none rw,bind 0 0
 +</code>
 +
 ==== Scan local IPv4 opened ports ==== ==== Scan local IPv4 opened ports ====
 <code bash> <code bash>
Line 486: Line 542:
  
 ===== Ubuntu/Debian ===== ===== Ubuntu/Debian =====
 +==== Automatically install dependencies with "dpkg -i" ====
 +  - dpkg -i
 +  - If it needs dependencies, get them automatically with apt-get -y -f --force-yes install. dpkg -i has generated the list of unresolved dependencies, apt-get -f will just pick it up.
 +  - Run the dpkg -i again
 +
 +==== Ubuntu/Debian auto login ====
 +<code bash>
 +sudo apt-get install mingetty
 +vim nano /etc/inittab
 +#change the line 1:2345:respawn:/sbin/getty 38400 tty1 to 1:2345:respawn:/sbin/mingetty --autologin <user-name>  --noclear tty1
 +</code>
 ==== Connect PPTP VPN ==== ==== Connect PPTP VPN ====
 <code bash> <code bash>
Line 491: Line 558:
 </code> </code>
  
 +==== Install TrueType fonts ====
 +<code bash>
 +sudo apt-get install ttf-mscorefonts-installer
 +</code>
 +
 +==== Install KDE ====
 +[[http://wiki.ubuntu.org.cn/KDE]]
 ==== Check rootkit and security holes ==== ==== Check rootkit and security holes ====
 <code bash> <code bash>
Line 554: Line 628:
 ==== Set timezone to GMT+8 ==== ==== Set timezone to GMT+8 ====
 <code bash> <code bash>
-echo "Asia/Shanghai" > /etc/timezone+ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 or or
 sudo dpkg-reconfigure tzdata sudo dpkg-reconfigure tzdata
Line 617: Line 691:
 <code bash> <code bash>
 kernelver=$(uname -r | sed -r 's/-[a-z]+//') kernelver=$(uname -r | sed -r 's/-[a-z]+//')
-ls /boot/{abi,vmlinuz,config,System.map,initrd.img}-[0-9\.-]*.* | grep -ve $kernelver | xargs rm -f +dpkg -l linux-{image,headers,image-extra}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver | xargs dpkg --force-all -P
-#dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver | xargs apt-get purge -y+
 </code> </code>
 ==== Install Lyx ==== ==== Install Lyx ====
dev/tricks/linux.1407388177.txt.gz · Last modified: 2020/06/06 23:32 (external edit)