====== Useful linux command ====== ===== lib search path ===== export LD_LIBRARY_PATH=. ===== cat file content to clipboard ===== //Source: StackOverflow// You're a little ambiguous. I expect you're probably a Linux user inside X who wants to put stuff in the X PRIMARY clipboard. It's important to understand that bash doesn't have a clipboard. There is no such thing as "the" clipboard, because bash can run on Windows, Mac OS X, lots of other OSes, inside X, outside X, ... Not to mention that X itself has three different clipboards itself. There's a wealth of clipboards you could be dealing with. Usually the clipboard you want to talk to has a utility that lets you talk to it. In case of X, yes, there's xclip (and others). If you're trying to talk to the Mac OS X clipboard, there's pbcopy. If you're in Linux terminal mode (no X) then maybe you need to look into gpm. There's also GNU screen which has a clipboard. To put stuff in there, look at the screen command "readreg". For Windows, read /dev/clipboard (thanks glenn). Note that xclip -selection c will send data to the clipboard that works with ^C, ^V in most applications. cat filename.java | xclip -selection c ===== find ===== * http://www.softpanorama.org/Tools/Find/using_exec_option_and_xargs_in_find.shtml * find all fiel start with 'filename' find . -name filename\* * find case insensitive find . -iname filename\* * find all [F,f]ilename and exclude filename find . -iname filename\* -not -name filename\* * find supports and, or, not (-a, -o, ! escaped as \!) find . -iname david\ gray\*ogg -and -type f > david_gray.m3u find . -iname "david gray*ogg" -and -type f > david_gray.m3u * search subdirectory find . -ipath \*david\ gray\*ogg -type f > david_gray.m3u * 2 list find ~ -type f \( -name \*.php -fprint php_files , -name \*.js -fprint javascript_files \) * prune find (-path -o -path ) \-prune -o -path * find using file attributes -nouser file is owned by someone no longer listed in /etc/passwd -nogroup the group the file belongs to is no longer listed in /etc/groups -owner file is owned by specified user. * print options find . -name \*.ogg -printf %f\\n %p filename, including name(s) of directory the file is in %m permissions of file, displayed in octal. %f displays the filename, no directory names are included %g name of the group the file belongs to. %h display name of directory file is in, filename isn't included. %u username of the owner of the file * print findings find . -iname david\ gray\*ogg -type f -fprint david_gray.m3u * execution find ~/oggs/ -iname \*.mp3 | xargs rm * more efficient execution. ';' is escaped for bash find ~/oggs/ -iname \*.mp3 -exec rm {} \; (a space after {}) * confirm mit -ok (same as -exec) find ~/oggs/ -iname \*.mp3 -ok rm {} \; * maxdepth vim -R `find . -name \*.dat -maxdepth 1` * regex /home/library/code$ find . -regex '.*/mp[0-4].*' * regex case insensitive /home/library/code$ find . -iregex '.*/mp[0-4].*' find . -regex './ch0[1-2]_0[1-3].*' * filesystem type find / -maxdepth 1 \( -fstype msdos \) -prune -or -print ===== - Tmux ===== * https://tmuxcheatsheet.com/ ==== - Sessions ==== tmux tmux new tmux new-session new Start a new session tmux new -s mysession new -s mysession Start a new session with the name mysession tmux kill-ses -t mysession tmux kill-session -t mysession kill/delete session mysession tmux kill-session -a kill/delete all sessions but the current tmux kill-session -a -t mysession kill/delete all sessions but mysession Ctrl + b $ Rename session Ctrl + b d Detach from session attach -d Detach others on the session (Maximize window by detach other clients) ==== - Copy Mode ==== ^ Command ^ Desc ^ | setw -g mode-keys vi | use vi keys in buffer ("Ctrl + b :" to enter command mode. | | Ctrl + b [ | Enter copy mode | Ctrl + b PgUp Enter copy mode and scroll one page up q Quit mode g Go to top line G Go to bottom line Scroll up Scroll down h Move cursor left j Move cursor down k Move cursor up l Move cursor right w Move cursor forward one word at a time b Move cursor backward one word at a time / Search forward ? Search backward n Next keyword occurance N Previous keyword occurance Spacebar Start selection Esc Clear selection Enter Copy selection Ctrl + b ] Paste contents of buffer_0 show-buffer display buffer_0 contents capture-pane copy entire visible contents of pane to a buffer list-buffers Show all buffers choose-buffer Show all buffers and paste selected save-buffer buf.txt Save buffer contents to buf.txt delete-buffer -b 1 delete buffer_1 ==== - Misc ==== Ctrl + b : Enter command mode set -g OPTION Set OPTION for all sessions setw -g OPTION Set OPTION for all windows set mouse on Enable mouse mode