Most Popular

1500 questions
837
votes
3 answers

What is the purpose of the lost+found folder in Linux and Unix?

There is a folder at the root of Linux and Unix operating systems called /lost+found/ What is it for? Under what circumstances would I interact with it? How would I interact with it?
Wesley
  • 15,133
837
votes
8 answers

Finding the PID of the process using a specific port?

I am installing hadoop on my Ubuntu system. When I start it, it reports that port 9000 is busy. I used: netstat -nlp|grep 9000 to see if such a port exists and I got this: tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN But how can I get the PID of the…
wuchang
  • 8,837
818
votes
6 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
  • 11,597
814
votes
6 answers

Difference between nohup, disown and &

What are the differences between $ nohup foo and $ foo & and $ foo & $ disown
Lesmana
  • 28,307
813
votes
13 answers

How do I grep for multiple patterns with pattern having a pipe character?

I want to find all lines in several files that match one of two patterns. I tried to find the patterns I'm looking for by typing grep (foo|bar) *.txt but the shell interprets the | as a pipe and complains when bar isn't an executable. How can I grep…
Dan
  • 9,672
788
votes
11 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
  • 68,112
788
votes
6 answers

Problem running find: missing argument to `-exec'

I'd like to find the files in the current directory that contain the text "chrome". $ find . -exec grep chrome find: missing argument to `-exec' What am I doing wrong?
ripper234
  • 32,533
776
votes
9 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
  • 7,887
751
votes
23 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
  • 28,748
746
votes
32 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
  • 8,025
740
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
  • 12,882
733
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
  • 16,536
720
votes
6 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 which…
Lazer
  • 36,385
707
votes
13 answers

How to force ssh client to use only password auth?

If I use pubkey auth from e.g.: an Ubuntu 11.04 how can I set the ssh client to use only password auth to a server? (just needed because of testing passwords on a server, where I default log in with key) I found a way: mv ~/.ssh/id_rsa…
LanceBaynes
  • 41,885
  • 101
  • 260
  • 359
706
votes
16 answers

How to clear journalctl

I couldn't find in google any safe way to clear systemd journal. Do anyone know any safe and reliable way to do so? Let's say I was experimenting with something and my logs got cluttered with various error messages. Moreover I'm displaying my…
Łukasz Zaroda
  • 7,671
  • 4
  • 21
  • 24