bind -x
was added in Bash 4.0 so this does not work with Bash 3.2 which comes with macOS.
Monitoring a log file with 'tail -f' is handy, but for emacs users monitoring the file with emacs is even better, because you can use all your familiar key bindings for copying regions, etc.
Kills all windows in a gnu screen session and terminates it , on pressing Control-f , useful in closing screen session with large number of windows . Add it to your screenrc .
This assumes you have an ssh key already held with putty agent (pageant) for authentication or it will prompt for password. You can add on multiple tunnels to multiple hosts accessible by the remotehost by simply adding in further -L bindport:host:hostport. In essence plink can basically use much the same syntax as openssh. I have included -C for compression -P for ssh port 22 and -N to not create a shell and -v for verbose output Show Sample Output
It connects to XXX.XXX.XXX.XXX port YYY, using a source port of "srcport" and binds the tunnel on local port "locport". Then you can connect to localhost:locport. With this command it's possible to connect to servers using a specific source port (useful when a firewall check the source port). Because of the connections starting from the same source port, this works well only for the first connection (for example, works well with SSH and bad with HTTP because of multiple requests). * It requires socat Show Sample Output
Create a secure tunnelled connection for access to a remote MySQL database. For example, connect with MySQL Workbench to root@127.0.0.1:13306. Show Sample Output
backup your files in tar archive + timestamp of backup Show Sample Output
This doesn't work in bash, but in zsh you can typeset -T to bind a scalar variable to an array. $PATH and $path behave this way by default.
Use the following key binding to search
----------------------------------------------------------------
ng
: Jump to line number n. Default is the start of the file.
nG
: Jump to line number n. Default is the end of the file.
/pattern
: Search for pattern. Regular expressions can be used. [/ = slash] Press / and then Enter to repeat the previous search pattern. Press ESC and then u to undo search highlighting.
n
: Go to next match (after a successful search).
N
: Go to previous match.
mletter
: Mark the current position with letter.
'letter
: Return to position letter. [' = single quote]
'^ or g
: Go to start of file.
'$ or G
: Go to end of file.
s
: Save current content (got from another program like grep) in a file.
= or Ctrl+g
: File information.
F
: continually read information from file and follow its end. Useful for logs watching. Use Ctrl+c to exit this mode.
-option
: Toggle command-line option -option.
h
: Help.
In exemple, screen can bind keys to switch between windows. I like to use Ctrl + Arrow to move left or right window. So I bind like this in .screenrc : bindkey ^[OD prev # Ctl-left, prev window bindkey ^[OC next # Ctl-right, next window Show Sample Output
This command is designed in order to avoid this error : /etc/init.d/apache2 force-reload * Reloading web server config apache2 httpd not running, trying to start (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs [fail] Show Sample Output
Caching-Nameserver Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: