
Shell
hushui
Coding Since 1998
展开
-
tftp linux
NA原创 2022-07-14 18:14:43 · 250 阅读 · 0 评论 -
history/bash
Linux shell history原创 2022-07-12 15:19:25 · 185 阅读 · 0 评论 -
ssh remote etc
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no example.com原创 2021-12-06 09:22:07 · 1043 阅读 · 0 评论 -
sed macro
[lake@localhost]$ echo "href=\"./index.php@commmnd=223\""href="./index.php@commmnd=223"[lake@localhost]$ echo "href=\"./index.php@commmnd=223\"" |sed 's/href\=\"\(.*\)\"/href\=\"\1\.html\"/g'href="./index.php@commmnd=223.html"Use [^\"]* ,...原创 2021-07-29 09:43:01 · 129 阅读 · 0 评论 -
SSH through HTTP proxy
SSH proxy原创 2022-10-08 16:44:49 · 681 阅读 · 0 评论 -
cp filelist
# sed for empty lines' removecat yourfilelist | sed -r '/^\s*$/d' |xargs -r cp -p -v --target-directory=/your_destnation_folder_name/原创 2021-07-27 17:16:49 · 188 阅读 · 0 评论 -
find all sub folders and move
find path/to/dir/* \! -name 'this_dir_stays_put' -type d -maxdepth 0 \ -exec mv {} new/location \;原创 2021-07-02 20:47:36 · 124 阅读 · 0 评论 -
pip install without root
[lake@server /]$ cat > $HOME/.pydistutils.cfg <<EOF> [install]> user=1> EOF[lake@server /]$ pip install --upgrade youtube_dlCollecting youtube_dl Downloading https://files.pythonhosted.org/packages/a4/43/1f586e49e68f8b41c4be41630.原创 2021-06-25 10:29:17 · 349 阅读 · 0 评论 -
Linux Shell 进入乱码目录/rm 怪异文件名
cd `ls | awk 'NR==1'`NR 由ls确定是第几个乱码目录例如[lake@localhhost down.52pojie.cn]$ ls |awk 'NR==2' ...原创 2021-04-10 12:07:22 · 305 阅读 · 0 评论 -
Qemu static chroot busybox buildroot
Refer toQemu2.x user mode/Ubuntu18 for Chroot/ARM qemu-user-static/CONFIG_BINFMT_MISC/Ubuntu/ARM/Rootfshttps://blog.youkuaiyun.com/hushui/article/details/103791704Try qemu/ARM/buildrootsudo mount -t proc /proc /home/lake/nfs/busybox-buildroot/proc...原创 2021-03-17 15:40:55 · 279 阅读 · 0 评论 -
diff -up ==> patch/format
[lake@localhost kernel]$ diff --helpUsage: diff [OPTION]... FILESCompare FILES line by line.Mandatory arguments to long options are mandatory for short options too. --normal output a normal diff (the default) -u, -U NUM, --un.原创 2021-01-29 22:31:09 · 265 阅读 · 1 评论 -
git big-files
Refer togit command tips: big files and remove in all brancheshttps://blog.youkuaiyun.com/hushui/article/details/1033616631. git find big fileslake@localhost: aosp_git_android$ git rev-list --all | xargs -rL1 git ls-tree -r --long | sort -u...原创 2021-01-23 13:35:20 · 304 阅读 · 1 评论 -
chrt FIFO example
[lake@localhost ~]$ cat test_chrt.sh#!/bin/bash## sudo chrt -f 99 /home/lake/test_chrt.sh#dd if=/home/lake/rk15G-size-sd-XXX.img of=/dev/sdd原创 2021-01-21 15:30:46 · 257 阅读 · 0 评论 -
systemd
1. list service 列出正在运行的 Unit$ systemctl list-units# 列出所有Unit,包括没有找到配置文件的或者启动失败的$ systemctl list-units --all# 列出所有没有运行的 Unit$ systemctl list-units --all --state=inactive# 列出所有加载失败的 Unit$ systemctl list-units --failed# 列出所有正在运行的、类型为 service 的.原创 2020-12-04 14:46:41 · 244 阅读 · 0 评论 -
scp folder/keep symbolic link etc (by tar or rsync)
1. folder sync scp -r user@server:remove_folder local2. keep symbolic link through tar# On the source server:# cd /path/to/contenttar cf - * | ssh user@destination '(cd /path/to/content; tar xf - )'The files are compressed and...原创 2020-12-03 17:46:00 · 370 阅读 · 0 评论 -
find all obj files and do du summary
find obj.XXX -type f -name '*.o' |xargs du -hcs |grep total$38M total53M total21M total原创 2020-12-02 16:10:20 · 146 阅读 · 0 评论 -
RHEL/Centos7 Shell tips: find file in mulitiple tgz
find . -type f -name "*.tgz" -printf [%f]\\n -exec tar -tf {} \; | grep -iE "[\[]|CompressedfilenameInsideTgz"原创 2020-11-13 17:16:29 · 121 阅读 · 0 评论 -
Windows BAT %~dp0
SET mypath=%~dp0set vc_path=%mypath:~0,-1%### Example C:\work\Develop>.\VC6\Bin\VCVARS32_win10.BATC:\work\Develop>echo %mypath%C:\work\Develop\VC6\Bin\C:\work\Develop>echo %mypath:~0,-1%C:\work\Develop\VC6\Bin原创 2020-10-09 16:08:51 · 234 阅读 · 0 评论 -
eMMC dd/performance check on aarch64
http://www.brendangregg.com/Perf/linux_observability_tools.pngeMMC dd/performance check on aarch64########## note bs size will affect performance./ # dd if=/dev/mmcblk0p1 of=/dev/null bs=1 count=1024MB670040576+0 records in6700...原创 2020-09-17 14:33:07 · 244 阅读 · 0 评论 -
Linux exp script to test remote ARM through SSH/login
[localroot]$ cat stresstest.exp#!/usr/bin/expectset timeout 60set prompt {~ # }#exp_internal 1set mtc 0set starttime [exec date ]set ip [lindex $argv 0]set NUM 0while { 1 } { set sleeptime [expr int(rand() * 10 + 30)] set NUM [ expr $N.原创 2020-09-17 11:01:21 · 149 阅读 · 0 评论 -
Rsync through SSH
Rsync through SSHExamplersync -r -l -t -e ssh --include="*.cpp" --include="*.c" --include="*.h" --include='*/' --exclude='*' --progress lake@10.0.0.1:/home/lake/live-git/ live-local rsync -r -l -t -e ssh --include=...原创 2020-09-11 09:07:22 · 174 阅读 · 0 评论 -
sed command line Shell: sed -i ‘s/lhu3/lake/‘ *
[lake@galaxy share]$ grep lhu3 * -Rqemu/firmware/60-edk2-arm.json: "filename": "/home/lhu3/usr/share/qemu/edk2-arm-code.fd",qemu/firmware/60-edk2-arm.json: "filename": "/home/lhu3/usr/share/qemu/edk2-arm-vars.fd",qemu/firmware/6...原创 2020-08-14 15:18:10 · 214 阅读 · 0 评论 -
bzip2recover 修复tar.bz2大文件
bzip2recover archive.tar.bz2bzip2 -tv rec*.bz2 > testoutput.log 2>&1# split into folders at each broken bitbzip2 -dc rec*.bz2 > recovery1.tarbzip2 -dc rec*.bz2 > recovery2_failing.tar./findtarheader.pl recovery2_failing.tar | hea...原创 2020-08-12 17:55:51 · 3634 阅读 · 0 评论 -
wget -r --convert-links doc/link
lake@PC-XXX:/mnt/c/work/test$ wget --level=inf --limit-rate=20K --recursive --page-requisites --user-agent=Mozilla --no-parent --convert-links --adjust-extension --no-clobber -e robots=off \ https://XXXXX.com/products/master/docs...原创 2020-07-24 08:33:52 · 416 阅读 · 0 评论 -
tar 排除某个目录 或者多个同名的子目录
tar zcvf /tmp/log.tgz ./* --exclude=./logs注意./* 与exclude的 ./logs必须目录层次一致原创 2020-06-14 14:13:05 · 1237 阅读 · 1 评论 -
RHEL/Centos7 Shell tips1 -- grep
ORgrep 'pattern1\|pattern2' filenamegrep -E 'pattern1|pattern2' filenameGrep ANDgrep中并没有AND操作符,但你可以使用-E选项来模拟。grep -E 'pattern1.*pattern2' filenamegrep -E 'pattern1.*pattern2|patte...原创 2020-02-11 20:55:12 · 166 阅读 · 0 评论 -
Linux/shell/sort
cat ~/tmp/output.txtunitStatus 23 2isoMode 99 5isoModeConfig 3 1occupied 17 4minValue 104 3maxValue 74 3oMinValue 11 2oMaxValue 12 2unitStatus2 11 2isoMode2 26 5isoModeC...原创 2019-12-27 16:34:48 · 116 阅读 · 0 评论 -
find/linux/shell OR/AND
$find . -name "*.c" -o -name "*.cpp"./library/Mapping.c./library/Communicator.cppArg:-a -and - operator AND-o -or - operator OR! - operator NOTExample...原创 2019-12-27 14:48:49 · 655 阅读 · 0 评论 -
Read text file/loop for each line/ Linux shell
Example 1 :#!/bin/bashwhile read linedo echo $linedone < yourfileinputpath.txtExample 2:#!/bin/bashfor line in `cat yourfileinputpath.txt`do echo $linedone...原创 2019-12-27 14:43:43 · 280 阅读 · 0 评论 -
sed 去除字符串中的括号部分内容
$ echo " char password[10][18]; struct NetworkVariable netVars[NUM_NETWORK_VARIABLES][2]" |sed -e 's/\[[^][]*\]//g' char password; struct NetworkVariable netVars原创 2019-12-27 14:28:48 · 2332 阅读 · 0 评论 -
awk print logcat remove column
10-22 14:52:57.916 1446 1754 D ORE-APS-BRIDGE: attr: 700710-22 14:52:57.916 1446 1754 D ORE-CORE: windowstaskinterface::windowstaskinterfaceSENDITwithReply10-22 14:52:58.044 1446 1755 D XM...原创 2019-12-03 11:34:55 · 131 阅读 · 0 评论 -
Fetch remove git server's patch only to avoid clone/download all
git@gitlab.com:TeeFirefly/FireNow-Nougat.githttps://gitlab.com/TeeFirefly/FireNow-Nougat.githttps://github.com/foo/bar/commit/${SHA}.patchExample:https://gitlab.com/TeeFirefly/FireNow...原创 2019-11-18 15:17:46 · 307 阅读 · 0 评论 -
SFTP/scp upload automatically in one line/shell, no interaction
1. Skip password for sftp download. refer to (sftp auto login/authorized_keys Putty etc)https://blog.youkuaiyun.com/hushui/article/details/1017757752. SFTP upload without interaction2.1 Use scp ins...原创 2019-11-06 09:28:22 · 215 阅读 · 0 评论 -
adb shell date
## ROOTC:\Temp>adb root && adb remountremount succeededC:\Temp>adb shell date --helpusage: date [-u] [-r FILE] [-d DATE] [+DISPLAY_FORMAT] [-D SET_FORMAT] [SET]Set/get the curre...原创 2019-11-01 10:40:26 · 2748 阅读 · 2 评论 -
Linux Change time zone in command line
lake@M5273296:~$ date -RMon, 28 Oct 2019 15:38:35 +0800lake@M5273296:~$ sudo cp /usr/share/zoneinfo/Asia/T /etc/localtimeTaipei Tashkent Tbilisi Tehran Tel_Aviv Thimbu Thimphu ...原创 2019-10-28 15:54:42 · 192 阅读 · 0 评论 -
SSH Tennel for Adb/GDB debug NDK
## Step 1OutSideHost/Linux build server/Remote 192.168.1.1root@OutSideHost:/localrepo/root/rm/jci/rm/engine$ netstat -an --tcp |grep 16000Make sure 16000/TCP is not used## Step 2 SSH ...原创 2019-06-14 16:25:46 · 561 阅读 · 0 评论 -
Android debug bridge command line-adb shell tips continue
Android debug bridge command line-adb shell tips continue1. Kill specified process / Linux hostadb shell pidof -s "my-target-process" | xargs -I{} kill "{}"2. Windows run.bat with prepare-...原创 2019-06-14 12:39:04 · 184 阅读 · 0 评论 -
network script through /etc/network/interfaces on Ubuntu
https://askubuntu.com/questions/1031709/ubuntu-18-04-switch-back-to-etc-network-interfacesThe following procedure works for Ubuntu18.04(Bionic Beaver)I.Reinstall theifupdownpackage:# ap...原创 2019-04-11 12:22:08 · 532 阅读 · 0 评论 -
get GCC build command line through `pkg-config --cflags --libs xxxxx`
Example/Test in Ubuntu18$ pkg-config --cflags --libs opencv-I/usr/include/opencv -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioin...原创 2019-02-21 09:41:01 · 331 阅读 · 0 评论 -
UTF-8 setting Linux mount /Windows Active code page/Python
1. vfat/LinuxDefault is ascii, Chinese/utf-8 is not shown OK[root@localhost ~]# mount |grep sdc/dev/sdc1 on /mnt/temp type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=...原创 2018-11-08 16:34:21 · 513 阅读 · 0 评论