Most Popular

1500 questions
737
votes
4 answers

Difference between nohup, disown and &

What are the differences between $ nohup foo and $ foo & and $ foo & $ disown
Lesmana
  • 25,703
  • 20
  • 76
  • 82
734
votes
4 answers

How to cycle through reverse-i-search in BASH?

In the terminal, I can type Ctrl + R to search for a matching command previously typed in BASH. E.g., if I type Ctrl + R then grep, it lists my last grep command, and I can hit enter to use it. This only gives one suggestion though. Is there any way…
Village
  • 5,299
  • 14
  • 45
  • 75
734
votes
5 answers

What does "--" (double-dash) mean?

I have seen -- used in the compgen command. For example: compgen -W "foo bar baz" -- b What is the meaning of the -- in there?
dogbane
  • 27,629
  • 13
  • 78
  • 60
717
votes
12 answers

How can I reduce a video's size with ffmpeg?

How can I use ffmpeg to reduce the size of a video by lowering the quality (as minimally as possible, naturally, because I need it to run on a mobile device that doesn't have much available space)? I forgot to mention that when the video can use…
xralf
  • 15,197
  • 27
  • 97
  • 142
687
votes
10 answers

How to switch between users on one terminal?

I'd like to log in as a different user without logging out of the current one (on the same terminal). How do I do that?
tshepang
  • 61,932
  • 85
  • 220
  • 285
686
votes
8 answers

What do the numbers in a man page mean?

So, for example, when I type man ls I see LS(1). But if I type man apachectl I see APACHECTL(8) and if I type man cd I end up with cd(n). I'm wondering what the significance of the numbers in the parentheses are, if they have any.
Wilduck
  • 6,987
  • 3
  • 14
  • 6
680
votes
24 answers

Preserve bash history in multiple terminal windows

I consistently have more than one terminal open. Anywhere from two to ten, doing various bits and bobs. Now let's say I restart and open up another set of terminals. Some remember certain things, some forget. I want a history that: Remembers…
Oli
  • 15,218
  • 7
  • 41
  • 51
675
votes
5 answers

Zip all files in directory?

Is there a way to zip all files in a given directory with the zip command? I've heard of using *.*, but I want it to work for extensionless files, too.
tkbx
  • 9,867
  • 12
  • 34
  • 41
668
votes
4 answers

Why is printf better than echo?

I have heard that printf is better than echo. I can recall only one instance from my experience where I had to use printf because echo didn't work for feeding some text into some program on RHEL 5.8 but printf did. But apparently, there are other…
amphibient
  • 11,842
  • 18
  • 60
  • 85
668
votes
29 answers

Why am I still getting a password prompt with ssh with public key authentication?

I'm working from the URL I found here: http://web.archive.org/web/20160404025901/http://jaybyjayfresh.com/2009/02/04/logging-in-without-a-password-certificates-ssh/ My ssh client is Ubuntu 64 bit 11.10 desktop and my server is Centos 6.2 64 bit. I…
Thom
  • 7,245
  • 4
  • 17
  • 16
663
votes
9 answers

How do I zip/unzip on the unix command line?

How can I create and extract zip archives from the command line?
joachim
  • 7,427
  • 4
  • 16
  • 8
639
votes
5 answers

/usr/bin vs /usr/local/bin on Linux

Why are there so many places to put a binary in Linux? There are at least these five: /bin/ /sbin/ /usr/bin/ /usr/local/bin/ /usr/local/sbin/ And on my office box, I do not have write permissions to some of these. What type of binary goes into…
Lazer
  • 33,497
  • 24
  • 68
  • 74
633
votes
3 answers

Using "${a:-b}" for variable assignment in scripts

I have been looking at a few scripts other people wrote (specifically Red Hat), and a lot of their variables are assigned using the following notation VARIABLE1="${VARIABLE1:-some_val}" or some expand other variables VARIABLE2="${VARIABLE2:-`echo…
Justin Garrison
  • 7,207
  • 3
  • 19
  • 21
628
votes
10 answers

Why is it better to use "#!/usr/bin/env NAME" instead of "#!/path/to/NAME" as my shebang?

I notice that some scripts which I have acquired from others have the shebang #!/path/to/NAME while others (using the same tool, NAME) have the shebang #!/usr/bin/env NAME. Both seem to work properly. In tutorials (on Python, for example), there…
TheGeeko61
  • 6,651
  • 3
  • 16
  • 17
625
votes
19 answers

How to get execution time of a script effectively?

I would like to display the completion time of a script. What I currently do is - #!/bin/bash date ## echo the date at start # the script contents date ## echo the date at end This just show's the time of start and end of the script. Would it be…
mtk
  • 25,150
  • 34
  • 89
  • 125