download zip of files only
Fri May 19 13:22:08 GMT 2023
From /weblog/unix
Sum time in script - http://www.markhneedham.com[..]-summing-the-total-time-from-a-log-file/ Special bash parameters - http://javarevisited.blogspot.com[..]ial-bash-parameters-in-script-linux.html ls sort by file size - http://www.unix.com[..]ns-answers/6518-sorting-ls-filesize.html How to use "~" - http://www.thegeekstuff.com/2010/06/bash-tilde-expansion use rlwrap to enable BASH like editing in SQLplus, and use screen to presist terminal sessions - http://binkley.blogspot.com[..]miracle-utilities-rlwrap-and-screen.html Ctrl+r searches through history Use the history command plus !# to run old commands Shell expansion using {} , e.g. cp foo.sh{,.old} == cp foo.sh foo.sh.old zsh have good auto complete http://www.pgrs.net/2007/9/6/useful-unix-tricks mkdir -p creates nested directories Use less instead of tail lsof shows open files ps will show process trees with the f flag http://www.pgrs.net/2007/10/8/useful-unix-tricks-part-2 !! is the previous command in the shell history Use vim -b to show nonprintable characters ** is a recursive wildcard in zsh cd – will return to the previous folder Use ctrl+z and kill %1 to kill a process that will not die pwdx shows the working directory of a process Use sh -x to debug shell scripts sysctl replaces /proc on macs http://pgrs.net/2009/2/20/useful-unix-tricks-part-3 ps -eo pcpu,pid,args | sort -n => check CPU% grep -sq "" /etc/lsb-release && lsb_release -rd => run command if file exist More about ps and free - http://www.thegeekstuff.com/2010/07/3-shell-scripts/ HTML tools for commandline - http://www.macdevcenter.com/lpt/a/6343 Bash history - http://www.talug.org/events/20030709/cmdline_history.html Tips of using shell, like saving all history - http://blog.andrewhays.net/love-your-terminal Standard Shell completion: Variablename completion Username completion Executable completion Filename and directory completion Hostname completion http://www.thegeekstuff.com/2013/11/bash-standard-completion/ replace cp long_and_complex_file_name long_and_complex_file_name.backup with this: cp long_and_complex_file_name{,.backup} http://www.jacopretorius.net[..]/2013/12/unix-trick-brace-expansion.html Use the history - http://www.jacopretorius.net/2013/12/my-favorite-unix-trick.html How to use xargs - http://www.thegeekstuff.com/2013/12/xargs-examples/ Nice presentation of man page - http://explainshell.com/explain?cmd=+ls+-ltr Parallel shell - http://www.ubuntugeek.com/pssh-parallel-ssh-tools.html A Beginner’s Guide to tmux - https://medium.com[..]s/a-beginners-guide-to-tmux-7e6daa5c0154
(google search)
(amazon search)
Fri Oct 21 12:30:48 GMT 2022
From /weblog/unix
Web base vim as tutorials - http://www.knowvim.com/ http://www.openvim.com/tutorial.html History of VIM - http://arstechnica.com[..]f-productivity-vims-20th-anniversary.ars Guide for editing text object, most already familiar with using 'w' for word editing, this blog discuss more about using 'p' for paragrahy and other related stuff. - http://blog.carbonfive.com[..]7/vim-text-objects-the-definitive-guide/ Seven habits of effective text editing , a lot of nice tip of using vim, like hlsearch , omni-completion http://www.moolenaar.net/habits.pdf http://video.google.com/videoplay?docid=2538831956647446078 vimdiff tips - http://blog.objectmentor.com[..]cles/2008/04/30/vim-as-a-diff-merge-tool http://gcody.blog.ccidnet.com[..]9899-uid-36931-do-showone-type-blog.html How to regex with line number - http://vim.wikia.com/wiki/Insert_line_numbers_2 cheat sheet of jumping around source code - http://www.faqs.org[..]inux-HOWTO/C-editing-with-VIM-HOWTO.html Nice analysis of good programming environment - http://www.benrady.com[..]why-i-switched-from-textmate-to-vim.html Creating macros in vim - http://smartic.us/2010/02/03/creating-macros-in-vim http://www.markhneedham.com/blog/2010/12/27/vim-learnings-so-far/ <- introduction to Command-T and FuzzyFinder Some VIM tips: Essential Vim editor navigation commands Vim search and replace – 12 powerful find and replace examples. How To add bookmarks inside the Vim editor How To record and play inside the Vim editor Correct spelling mistakes automatically inside the Vim Editor Automatic word completion using Ctrl-X Enable thesaurus option in the Vim editor Vim autocommand magic. Add custom header to your files automatically. Convert Vim editor to a beautiful source code browser. Use the Vim editor as a bash IDE, or C/C++ IDE, or Perl IDE. http://www.thegeekstuff.com/2010/04/vim-editor-tutorial/ https://spin.atomicobject.com[..]com/2016/04/19/vim-commands-cheat-sheet/ ctrl+w, ctrl+w , vimdiff switch folder - hack2live.blogspot.com/2009/02/vimdiff-shortcut-keys.html tutorial - http://javarevisited.blogspot.com[..]editor-in-unix-example-tutorial-and.html https://danielmiessler.com/study/vim/ https://www.reddit.com[..]s/3mfvdg/how_do_i_go_about_learning_vim/ https://towardsdatascience.com/how-to-vim-b1719c67f76a Compilation plugin - http://www.vim.org/scripts/script.php?script_id=3115#2.9.3 Highlight multiple searches at the same time, each with a different color. - http://www.vim.org/scripts/script.php?script_id=479 http://www.vim.org/scripts/script.php?script_id=2666#2.6.0 C/C++ IDE - http://www.vim.org/scripts/script.php?script_id=213 http://blog.wuwon.id.au[..]10/vim-plugin-for-navigating-c-with.html Evil, putting vi in emacs - http://spin.atomicobject.com/2013/02/28/emacs-or-vim-evil/ Fixing syntax at solaris, "export TERM=xtermc", ":syntax enable" - http://kdl.nobugware.com/post/2006/12/01/23-xterm-color-on-unix Graph your Vim undo tree in style. - http://sjl.bitbucket.org/gundo.vim/ Introduction to Selecta and Command-T, tool for fuzzy mapping and open files easier - http://marcovaltas.com/2013/12/27/selecta-on-vim-wildignore.html http://superuser.com[..]d-the-vimrc-file-be-located-on-windows-7 Open Visual Studio config as XML - https://groups.google.com/forum/#!topic/vim_use/HzVM9tjJP08 Snippert library ( e.g. function template ) - https://www.reddit.com[..]3h7lca/which_snippet_library_do_you_use/ https://www.reddit.com[..]t_are_your_musthave_configs_and_plugins/ https://www.reddit.com[..]mments/2w22gf/edit_google_docs_with_vim/ https://www.reddit.com[..]nts/3ijsi2/original_post_a_vimrc_primer/ https://www.reddit.com[..]an_autocomplete_plugin_if_yes_which_one/ gUU to turn whole line upper case, and guu to turn whole line lower case - https://www.reddit.com[..]_guu_makes_an_entire_line_lowercase_and/ can use :TOhtml to turn a text file to HTML - http://jezenthomas.com/how-i-write-invoices-in-vim/ set encoding=utf-8 - https://www.reddit.com[..]how_to_reliably_switch_to_using_utf8_by/ If you like to test the regex for vi, can refer to this - http://www.virex.org/ http://www.hostingadvice.com[..]/blog/vim-creator-champions-charityware/ Another blog about using vim as IDE - https://spacevim.org/2017/02/11/use-vim-as-a-java-ide vim cheat sheet - https://i.redd.it/8xu7welujmx41.png http://vimsheet.com https://github.com/ibhagwan/dots/blob/master/README-vim.md https://blog.antoyo.xyz/vim-tips https://simianwesthighlandterrier.htmlpasta.com/ Write Code Faster in Vim - https://jacobcomer.medium.com[..]om/write-code-faster-in-vim-c564ff9b9f6c https://www.reddit.com[..]d_using_spacemacsevil_and_made_this_vim/ How Vim works internally? - https://www.reddit.com[..]omments/hpt9l9/how_vim_works_internally/ Sample example of a VIM plugin - https://www.statox.fr/posts/vim/vim_flash_yanked_text/ Vim has a built-in Emoji Picker! - https://www.reddit.com[..]s/ioewb0/vim_has_a_builtin_emoji_picker/ Fast Typing: vi - https://codefaster.substack.com/p/fast-typing-vi Vim as HTTP client - https://nazarii.bardiuk.com/posts/vim-curl.html Vim team - https://se.ewi.tudelft.nl/desosa2019/chapters/vim/ How To Password Protect Text Files Using Vim Editor In Linux - https://www.noblevolkswagen.com.au[..]om.au/special-offers/m/passenger-offers/ Learning Vim: What I Wish I Knew - https://hackernoon.com[..]ning-vim-what-i-wish-i-knew-b5dca186bef7 How to format/sort/aggregate text in shell, and also vim - https://vimways.org/2019/vim-and-the-shell/ Inserting incremental numbers for each key in a JSON file? - https://www.reddit.com[..]g_incremental_numbers_for_each_key_in_a/ It’s time to Edit effectively in Vim, a visual article - https://susamn.medium.com[..]ely-in-vim-a-visual-article-76f9d0b45938 Completion tips - https://georgebrock.github.io/talks/vim-completion/ Vim's life-changing c% - https://thepugautomatic.com/2014/03/vims-life-changing-c-percent/ Vim Sessions - https://medium.com/vim-drops/vim-sessions-50756b2c603a How to set up Vim in 2021? - https://medium.com[..]ng-vim-like-an-ide-1-3-vimrc-d484cc41fc2
(google search)
(amazon search)
Wed Jul 20 01:36:17 GMT 2022
From /weblog/unix
Built-in checksum tool "cksum" - https://www.freecodecamp.org[..]inux-how-to-check-if-two-files-are-same/ Disable root password - http://www.debianadmin.com[..]le-and-disable-ubuntu-root-password.html How can we fine tune permission more than chmod - http://man-wiki.net/index.php/3:cap_from_text 1. From a shell account on a Unix box behind the firewalled network do this: ssh -N -R 3389:localhost:22 [email protected]2. Leave work and go home. From a shell account on remote-unix-box.net do this: ssh 127.0.0.1 -p 3389 http://16systems.com/acls.txt
(google search)
(amazon search)
Fri Apr 01 03:29:26 GMT 2016
From /weblog/unix/script
How to use eval, hash, readonly, shift, getopts, set, unset, let and shopt - http://www.thegeekstuff.com/2010/08/bash-shell-builtin-commands Sample bash completion SSH_COMPLETE=( $(cut -f1 -d' ' ~/.ssh/known_hosts |\ tr ',' '\n' |\ sort -u |\ grep -e '[:alpha:]') ) complete -o default -W "${SSH_COMPLETE[*]}" ssh http://kasparov.skife.org/blog/stuff/starting-a-meme.html Check history statistic - brianm@binky:~$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head 164 svn 52 cd 42 ssh 32 sudo 22 git 16 ls 16 for 14 echo 13 man 10 curl brianm@binky:~$ http://bluebones.net/2008/04/history-meme/ easy way to do "[-h|--help][-n|--name ]" - http://binkley.blogspot.com/2016/03/bash-long-options.html
(google search)
(amazon search)
Wed Dec 30 07:09:53 GMT 2015
From /weblog/unix
Embedded Programming with the GNU Toolchain - http://www.bravegnu.org/gnu-eprog/
(google search)
(amazon search)
Mon Nov 09 07:34:36 GMT 2015
From /weblog/unix
Look like a nice tools provide more information for performance issue - http://oprofile.sourceforge.net/examples/ Check CPU problem with prstat http://javaeesupportpatterns.blogspot.ca[..]stat-solaris-pinpoint-high-cpu-java.html http://javaeesupportpatterns.blogspot.ca[..]stat-linux-how-to-pinpoint-high-cpu.html http://javaeesupportpatterns.blogspot.ca[..]prstat-aix-how-to-pinpoint-high-cpu.html http://www.thegeekstuff.com/2012/03/reverse-engineering-tools If we like to trace process detail flow, system call and file opened - http://www.ussg.iu.edu/UAU/advcomm/truss.html http://fuse4bsd.creo.hu/localcgi/man-cgi.cgi?truss+1 -l Includes the id of the responsible lightweight process (LWP) with each line of trace output. If -f is also specified, both the process-id and the LWP-id are included. If the process hang and we like to check why, can try pstack - http://www.google.com[..]=pstack&sourceid=opera&ie=utf-8&oe=utf-8 Check where is the core dump to - http://groups.google.com[..]s/browse_thread/thread/9f46dfb277c72cc8# Use gcore to generate coredump for running process - http://www.gsp.com/cgi-bin/man.cgi?section=1&topic=gcore If we like to check the which process id using which port, we can use lsof or "pfiles /proc/*" 1) save the output of "pfiles /proc/*" to a file 2) grep the file for that port, then find the PID, e.g., say here is the part of the output: 5859: java -Djava.awt.headless=true -DX_R_BRGD -Xms512M -Xmx1024M -Djava.io. Current rlimit: 1024 file descriptors 0: S_IFCHR mode:0666 dev:85,0 ino:980953 uid:0 gid:3 rdev:13,2 O_RDONLY|O_LARGEFILE
....... ( 125 FD after) ......
125: S_IFSOCK mode:0666 dev:313,0 ino:40404 uid:0 gid:0 size:0 O_RDWR sockname: AF_INET 10.152.22.22 port: 18075 peername: AF_INET 169.19.21.63 port: 41792
Then PID 5859 is the process working with the port 18075, however, it only work for process which is viewable according to your permission setting Another probably easier way, and provide more information, is using lsof -i :[port] - http://javarevisited.blogspot.com[..]-unix-netstat-lsof-command-examples.html If we like to check the which process id using which file, we can use fuser - http://linuxcommand.org/man_pages/fuser1.html Check host and port that any process accessing using lsof - http://www.geekology.co.za[..]-are-accessing-internet-on-unix-machine/ How do I monitor or view the thread count of a certain process - ps -o pid,comm,user,thcount -p - http://superuser.com[..]thread-count-of-a-certain-process-on-aix
Examples of using strace, use -e to trace function call is useful - http://www.thegeekstuff.com/2011/11/strace-examples
The nm commands provides information on the symbols being used in an object file or executable file. - http://www.thegeekstuff.com/2012/03/linux-nm-command/
Use pmap -s -x to look at what's in the virtual address space of yr process and what portion thereof is resident in physical memory.
(google search)
(amazon search)
|