Most Popular

1500 questions
119
votes
3 answers

What is "mail", and how is it navigated?

The program is located in /usr/bin/mail. Upon execution, Version 8.1.2 01/15/2001 is shown. Entering list produces: Commands are: next, alias, print, type, Type, Print, visual, top, touch, preserve, delete, dp, dt, undelete, unset, mail, mbox,…
cwd
  • 45,389
119
votes
11 answers

Bash history: "ignoredups" and "erasedups" setting conflict with common history across sessions

First of all, this is not a duplicate of any existing threads on SE. I have read these two threads (1st, 2nd) on better bash history, but none of the answers work - - I am on Fedora 15 by the way. I added the following to the .bashrc file in the…
its_me
  • 13,959
119
votes
3 answers

What does `kill -0` do?

I recently came across this in a shell script. if ! kill -0 $(cat /path/to/file.pid); then ... do something ... fi What does kill -0 ... do?
slm
  • 369,824
119
votes
4 answers

Watch YouTube videos in terminal

I'm looking for a way to watch YouTube videos in terminal (not in a browser or another window, but right there, in any bash session). Is there a simple way to do this? I imagine something like this: $ youtube I already know how to…
119
votes
4 answers

How can I create a message box from the command line?

How can I create a message box from the command line, either GUI message boxes or message boxes shown inside the terminal? It would also be interesting to be able to get a simple input back from the user, for example, an input given with radio…
119
votes
3 answers

What's the difference between "realpath" and "readlink -f"

I've read a lot about the realpath command and how it has been deprecated with readlink -f being now recommended.  I have also seen in some places that the reason why realpath was introduced was for the lack of such functionality in readlink and…
Felipe Leão
  • 1,355
119
votes
5 answers

How to copy the partition layout of a whole disk using standard tools

I want to take a backup of the whole partition layout of a hard drive, including logical drives, so that I can restore that layout to another disk. I do not want to copy the contents of the partitions, only the layout. For the primary and extended…
118
votes
14 answers

How can I search history with text already entered at the prompt in zsh?

In zsh, I know that I can search history with Ctrl+r. However, oftentimes I start to type a command directly at the prompt, but then realize I should be searching history. When I hit Ctrl+r, it brings up a blank history search prompt like…
118
votes
13 answers

Find duplicate files

Is it possible to find duplicate files on my disk which are bit to bit identical but have different file-names?
student
  • 18,305
118
votes
3 answers

Why doesn't grep ignore binary files by default?

The manpage for grep describes the -I flag as follows: -I Ignore binary files. This option is equivalent to --binary-file=without-match option. It also says this about binary files: --binary-files=value Controls searching and…
user36078
118
votes
6 answers

How to get keycodes for xmodmap?

I'm trying to use xmodmap to remap Alt / Super keys on Dell L100 keyboard, and have trouble getting the keycodes. For instance, using xev doesn't give me keycode for Alt FocusOut event, serial 36, synthetic NO, window 0x4a00001, mode…
Yaroslav Bulatov
  • 1,281
  • 2
  • 9
  • 5
118
votes
2 answers

How does tcp-keepalive work in ssh?

I am trying to code a shell-script that uses a ssh-connection for doing "heartbeats". I want to terminate the client- and server-side of that connection after a certain timeout (after the connection drops). What I found so far: TCPKeepAlive yes/no…
Nils
  • 18,492
118
votes
7 answers

how to avoid ssh asking permission?

We are attempting to speed up the installation of oracle nodes for RAC installation. this requires that we get ssh installed and configured so that it doesn't prompt for a password. The problem is: On first usage, we are prompted for RSA key…
118
votes
8 answers

Preventing grep from causing premature termination of "bash -e" script

This script does not output after: #!/bin/bash -e echo "before" echo "anything" | grep e # it would if I searched for 'y' instead echo "after" exit I could solve this by removing the -e option on the shebang line, but I wish to keep it so my…
iago-lito
  • 2,751
118
votes
7 answers

How to copy and paste with a mouse with tmux

I'm using tmux and OSX. When copying and pasting from the terminal with tmux I'm able to hold down Option and select text. However I can't get the text to stay inside the pane. So when I want to copy text I either need to cycle the pane to the far…
mbigras
  • 3,100