mostly from https://stackoverflow.com
nohup command >/dev/null 2>&1 &
jobs -l
ps -f -U
ps -ef | grep "command name"
history #show history command
fc [-e true] pid1 pid2 #repeat command with pid1 to pid2
copy between terminal
a) gvim -v
In editor :echo has("clipboard")
set clipboard=unnamedplus
b)
esc m a
esc m b
:'a,'b w! xfer
ESC :r xfer
vim spell :setlocal spell spelllang=en_us
unar file.rar
zip paper_ams.zip * -x "temp/*" // not include temp file folder
zip -r xx.zip directory
zip -u xx.zip file // update the file in zip
scp -P port -r folder ...
sftp
get file
put file
https://www.cs.fsu.edu/~myers/howto/commandLineSSH.html
ssh -p port_number
scp -P port_number
scp file1 file2
scp user@hostname:"file1 file2" local
The -r option can be used to copy directories recursively.
putty get x11 connection over shh from win/mac to linux
https://askubuntu.com/questions/971171/how-to-use-putty-to-get-x11-connections-over-ssh-from-windows-to-ubuntu
https://kb.iu.edu/d/bdnt
tmux
tmux show -g | sed 's/^/set -g /' > ~/.tmux.conf
tmux show-options -g | grep prefix
tmux source-file ~/.tmux.conf
set -g default-terminal "screen-256color
scp -P port -r folder ...
sftp
get file
put file
https://www.cs.fsu.edu/~myers/howto/commandLineSSH.html
ssh -p port_number
scp -P port_number
scp file1 file2
scp user@hostname:"file1 file2" local
The -r option can be used to copy directories recursively.
putty get x11 connection over shh from win/mac to linux
https://askubuntu.com/questions/971171/how-to-use-putty-to-get-x11-connections-over-ssh-from-windows-to-ubuntu
https://kb.iu.edu/d/bdnt
tmux
tmux show -g | sed 's/^/set -g /' > ~/.tmux.conf
tmux show-options -g | grep prefix
tmux source-file ~/.tmux.conf
set -g default-terminal "screen-256color
alias tmux='tmux -2' in .bashrc
prefix ? #show shortcuts
unbind C-b
prefix ? #show shortcuts
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefixa)create window prefix c
next window prefix n
last window prefix p
prefix number
b)detach session
prefix d/D
tmux ls
tmux kill-session -t number
tmux attach -t number
c)split
horizontally prefix "
vertically %
move from pane to pane prefix arrow
4)kill current pane
prefix x
5)copy/paste with mouse
shift +mouse
option + mouse (macos)
prefix z maximum pane
6)copy and paste
1. Enter ‘copy mode’ by pressing CTRL+b, [.
2. Use the arrow keys to go to the position from where you want to start copying. Press CTRL+SPACE to start copying.
3. Use arrow keys to go to the end of text you want to copy. Press ALT+w or CTRL+w to copy into Tmux buffer.
4. Press CTRL+b, ] to paste in a possibly different Tmux pane/window.
5. create panel in the current panel
add following lines to ~/.tmux.conf
paste multiple files into one
cat file1 file2 > newfile (>> append, > rewrite)
ssh to remote computer, but lost connection a few minutes.
add
ClientAliveInterval 30
https://unix.stackexchange.com/questions/12032/how-to-create-a-new-window-on-the-current-directory-in-tmux
https://askubuntu.com/questions/202075/how-do-i-get-vim-to-remember-the-line-i-was-on-when-i-reopen-a-file/202077
https://www.cyberciti.biz/faq/how-to-check-os-version-in-linux-command-line/
https://askubuntu.com/questions/224867/how-to-change-the-color-of-particular-file
bind-key C-a send-prefixa)create window prefix c
next window prefix n
last window prefix p
prefix number
b)detach session
prefix d/D
tmux ls
tmux kill-session -t number
tmux attach -t number
c)split
horizontally prefix "
vertically %
move from pane to pane prefix arrow
4)kill current pane
prefix x
5)copy/paste with mouse
shift +mouse
option + mouse (macos)
prefix z maximum pane
6)copy and paste
1. Enter ‘copy mode’ by pressing CTRL+b, [.
2. Use the arrow keys to go to the position from where you want to start copying. Press CTRL+SPACE to start copying.
3. Use arrow keys to go to the end of text you want to copy. Press ALT+w or CTRL+w to copy into Tmux buffer.
4. Press CTRL+b, ] to paste in a possibly different Tmux pane/window.
5. create panel in the current panel
add following lines to ~/.tmux.conf
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
- Add these lines in a file by name
~/.tmux.conf
.
Note that for a newer tmux version (2.4 and above I think, not sure), the last three lines should be replaced with:bind P paste-buffer bind-key -t vi-copy 'v' begin-selection bind-key -t vi-copy 'y' copy-selection bind-key -t vi-copy 'r' rectangle-toggle
bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi y send-keys -X copy-selection bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
- Now you can enter copy mode by pressing
CTRL
+b
,[
, and then go to start point, press ‘v’ and start copying. After you have selected text you want to copy, you can just press ‘y’ (or the default ‘enter’ key) to copy the text into Tmux’s buffer. This is exactly the commands you would use in Vim to copy text. - To paste, press
CTRL
+b
,P
. Note that it’s capital ‘p’ (i.e.SHIFT
+p
). This again is similar to Vim’s shortcut ‘p’ for paste, though not exactly similar.
paste multiple files into one
cat file1 file2 > newfile (>> append, > rewrite)
ssh to remote computer, but lost connection a few minutes.
add
ClientAliveInterval 30
TCPKeepAlive yes
ClientAliveCountMax 10000
in the server machine /etc/ssh/sshd_config .
service ssh restart or service sshd restart
ssh -o "ServerAliveInterval 60" -o "ServerAliveCountMax 120" <SERVER_ADDRESS>
Check syntax errors in the /etc/ssh/sshd configuration file.
/usr/sbin/sshd -T
vim remember last position
vimrc add:
ls show color for different extension
bashrc add:
After apt-get update && apt-get upgrade you should use apt-get clean to remove the installed packages from /var/apt/cache.
https://www.rushiagr.com/blog/2016/06/16/everything-you-need-to-know-about-tmux-copy-pasting-ubuntu/in the server machine /etc/ssh/sshd_config .
service ssh restart or service sshd restart
ssh -o "ServerAliveInterval 60" -o "ServerAliveCountMax 120" <SERVER_ADDRESS>
Check syntax errors in the /etc/ssh/sshd configuration file.
/usr/sbin/sshd -T
vim remember last position
vimrc add:
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
ls show color for different extension
bashrc add:
LS_COLORS="di=1;35:*.c=4;31:*.mp3=1;32;41"
LS_COLORS='*.c=01;32:*.out=31:*.sh=01;35:'
color refer to : http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
# date +%T -s "10:13:13"
# timedatectl set-time 09:08:07
# date --set=”20140125 09:17:00”
After apt-get update && apt-get upgrade you should use apt-get clean to remove the installed packages from /var/apt/cache.
show linux distro with terminal
cat /etc/os-release
cat /etc/os-release
show architecture
ubuntu unable to locate package
install linux in termux
atilo
uname -a
sudo rpm –i sample_file.rpm
vi /etc/apt/source.list
deb http://archive.ubuntu.com/ubuntu/ release_name trusty main universe restricted multiverse
install linux in termux
atilo
termux-desktop
Reference:
https://unix.stackexchange.com/questions/12032/how-to-create-a-new-window-on-the-current-directory-in-tmux
https://askubuntu.com/questions/202075/how-do-i-get-vim-to-remember-the-line-i-was-on-when-i-reopen-a-file/202077
https://www.cyberciti.biz/faq/how-to-check-os-version-in-linux-command-line/
https://askubuntu.com/questions/224867/how-to-change-the-color-of-particular-file
No comments:
Post a Comment