Most Popular
1500 questions
616
votes
6 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:* …

wuchang
- 6,597
- 5
- 15
- 16
605
votes
10 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
- 36,957
- 90
- 243
- 345
603
votes
25 answers
Repeat a Unix command every x seconds forever
There's a built-in Unix command repeat whose first argument is the number of times to repeat a command, where the command (with any arguments) is specified by the remaining arguments to repeat.
For example,
% repeat 100 echo "I will not automate…

dreeves
- 6,179
- 3
- 14
- 7
601
votes
4 answers
Does curl have a --no-check-certificate option like wget?
I am trying to make a curl request to one of our local development servers running a dev site with a self-signed SSL cert. I am using curl from the command line.
I saw some blog posts mentioning that you can add to the list of certificates or…

cwd
- 42,359
- 67
- 143
- 166
588
votes
15 answers
What if 'kill -9' does not work?
I have a process I can't kill with kill -9 . What's the problem in such a case, especially since I am the owner of that process. I thought nothing could evade that kill option.

tshepang
- 61,932
- 85
- 220
- 285
588
votes
9 answers
What is the difference between /opt and /usr/local?
According to the Filesystem Hierarchy Standard, /opt is for "the installation of add-on application software packages". /usr/local is "for use by the system administrator when installing software locally". These use cases seem pretty similar. …

Patches
- 6,222
- 3
- 14
- 11
555
votes
7 answers
Scroll inside Screen, or Pause Output
I use screen for my command-line tasks while managing the servers where I work. I usually run small commands (mostly file-system tasks) but sometimes I run more extensive tasks (like DBA).
The output of those tasks is important to me. Since I use…

AeroCross
- 6,083
- 4
- 16
- 7
555
votes
27 answers
How can I resolve a hostname to an IP address in a Bash script?
What's the most concise way to resolve a hostname to an IP address in a Bash script? I'm using Arch Linux.

Eugene Yarmash
- 13,945
- 12
- 43
- 56
551
votes
10 answers
How to append multiple lines to a file
I am writing a bash script to look for a file if it doesn't exist then create it and append this to it:
Host localhost
ForwardAgent yes
So "line then new line 'tab' then text" I think its a sensitive format.
I know you can do this:
cat…

TheLegend
- 5,955
- 4
- 14
- 14
538
votes
9 answers
How to display `top` results sorted by memory usage in real time?
How can I display the top results in my terminal in real time so that the list is sorted by memory usage?

Theodor Coogan
- 5,381
- 3
- 11
- 3
534
votes
10 answers
Can less retain colored output?
Can I get less not to monochrome its output?
E.g., the output from git diff is colored, but git diff | less is not.

ripper234
- 29,573
- 43
- 82
- 90
530
votes
3 answers
What is a bind mount?
What is a “bind mount”? How do I make one? What is it good for?
I've been told to use a bind mount for something, but I don't understand what it is or how to use it.

Gilles 'SO- stop being evil'
- 766,554
- 187
- 1,586
- 2,083
527
votes
7 answers
How do I check package version using apt-get / aptitude?
Before I install a package, I'd like to know what version I would get.
How do I check the version before installing using apt-get or aptitude on Debian or Ubuntu?
user4069
524
votes
11 answers
How do I copy a folder keeping owners and permissions intact?
So I was going to back up my home folder by copying it to an external drive as follows:
sudo cp -r /home/my_home /media/backup/my_home
With the result that all folders on the external drives are now owned by root:root. How can I have cp keep the…

Psachnodaimonia
- 5,365
- 3
- 13
- 8
520
votes
7 answers
Can I zip an entire folder using gzip?
I'm trying to zip a folder in unix.
Can that be done using the gzip command?

user1269502
- 5,301
- 4
- 12
- 4