All Questions

Filter by
Sorted by
Tagged with
1860 votes
3 answers
441k views

Why does man print "gimme gimme gimme" at 00:30?

We've noticed that some of our automatic tests fail when they run at 00:30 but work fine the rest of the day. They fail with the message gimme gimme gimme in stderr, which wasn't expected. Why are we ...
Jaroslav Kucera's user avatar
1631 votes
16 answers
3.5m views

How do I get the size of a directory on the command line?

I tried to obtain the size of a directory (containing directories and sub directories) by using the ls command with option l. It seems to work for files (ls -l file name), but if I try to get the size ...
Abdul Al Hazred's user avatar
1601 votes
10 answers
522k views

What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

I think these terms almost refer to the same thing, when used loosely: terminal shell tty console What exactly does each of these terms refer to?
Lazer's user avatar
  • 35.3k
1366 votes
12 answers
3.4m views

How to correctly add a path to PATH?

I'm wondering where a new path has to be added to the PATH environment variable. I know this can be accomplished by editing .bashrc (for example), but it's not clear how to do this. This way: export ...
Paolo's user avatar
  • 17.4k
1271 votes
13 answers
4.8m views

How to copy files from one machine to another using ssh

I am using a Linux (CentOS) machine, and I have already connected to another system using SSH. Now, my question is: How can I copy files from one system to another system? Suppose, in my environment, ...
user3021349's user avatar
  • 16.6k
1191 votes
9 answers
3.6m views

How to install a deb file, by dpkg -i or by apt?

I have a deb package for installation. Shall I install by dpkg -i my.deb, or by apt? Will both handle the software dependency problem well? If by apt, how can I install from the deb by apt?
Tim's user avatar
  • 102k
994 votes
6 answers
1.8m views

How to see full log from systemctl status service?

I check service status with systemctl status service-name. By default, I see few rows only, so I add -n50 to see more. Sometimes, I want to see full log, from start. It could have 1000s of rows. Now,...
10robinho's user avatar
  • 10.3k
961 votes
10 answers
1.8m views

How can I replace a string in a file(s)?

Replacing strings in files based on certain search criteria is a very common task. How can I replace string foo with bar in all files in the current directory? do the same recursively for sub ...
terdon's user avatar
  • 242k
952 votes
3 answers
562k views

How to unfreeze after accidentally pressing Ctrl-S in a terminal?

It's a situation that has happened quite often to me: after I press (with a different intention) Ctrl-S in a terminal, the interaction (input or output) with it is frozen. It's probably a kind of "...
imz -- Ivan Zakharyaschev's user avatar
890 votes
2 answers
2.2m views

How do I make `ls` show file sizes in megabytes?

What commands do I need for Linux's ls to show the file size in MB?
Paul Sheldrake's user avatar
883 votes
13 answers
1.0m views

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 ...
xralf's user avatar
  • 15.4k
862 votes
2 answers
179k views

Why was '~' chosen to represent the home directory?

I have often wondered why the ~ (tilde) character represents the home directory of a user. Is there a reason behind this, or is it just because tilde is an infrequently used character?
Lelouch Lamperouge's user avatar
816 votes
4 answers
582k views

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 ...
Village's user avatar
  • 5,045
814 votes
5 answers
359k views

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's user avatar
  • 29.7k
803 votes
13 answers
1.8m views

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 ...
Dan's user avatar
  • 9,492
801 votes
40 answers
942k views

Tracking down where disk space has gone on Linux?

When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time ...
user avatar
788 votes
3 answers
434k views

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's user avatar
  • 14.3k
785 votes
6 answers
1.3m views

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's user avatar
  • 31.8k
784 votes
6 answers
407k views

Difference between nohup, disown and &

What are the differences between $ nohup foo and $ foo & and $ foo & $ disown
Lesmana's user avatar
  • 27.4k
756 votes
6 answers
2.1m views

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's user avatar
  • 10.9k
748 votes
8 answers
1.7m views

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 ...
wuchang's user avatar
  • 7,927
746 votes
9 answers
217k views

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 ...
Wilduck's user avatar
  • 7,587
737 votes
10 answers
3.2m views

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's user avatar
  • 65.7k
729 votes
30 answers
1.3m views

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....
Thom's user avatar
  • 7,855
716 votes
20 answers
997k views

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 ...
mtk's user avatar
  • 27.6k
713 votes
24 answers
278k views

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 ...
Oli's user avatar
  • 16.1k
710 votes
4 answers
314k views

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 ...
amphibient's user avatar
  • 12.5k
688 votes
5 answers
227k views

/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 ...
Lazer's user avatar
  • 35.3k
677 votes
12 answers
819k views

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 ...
LanceBaynes's user avatar
  • 40.2k
677 votes
9 answers
2.4m views

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

How can I create and extract zip archives from the command line?
joachim's user avatar
  • 7,687
666 votes
11 answers
292k views

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....
TheGeeko61's user avatar
  • 7,041
655 votes
4 answers
499k views

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 ...
Justin Garrison's user avatar
649 votes
24 answers
721k views

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 ...
dreeves's user avatar
  • 6,639
644 votes
11 answers
1.3m views

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 ...
TheLegend's user avatar
  • 6,885
629 votes
8 answers
468k views

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 ...
Patches's user avatar
  • 6,632
624 votes
15 answers
778k views

What if 'kill -9' does not work?

I have a process I can't kill with kill -9 <pid>. 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's user avatar
  • 65.7k
617 votes
4 answers
938k views

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 ...
cwd's user avatar
  • 45.4k
611 votes
26 answers
631k views

How to generate a random string?

I would like to generate a random string (e.g. passwords, user names, etc.). It should be possible to specify the needed length (e.g. 13 chars). What tools can I use? (For security and privacy ...
landroni's user avatar
  • 10.9k
607 votes
16 answers
853k views

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 ...
Łukasz Zaroda's user avatar
607 votes
27 answers
910k views

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's user avatar
587 votes
10 answers
965k views

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's user avatar
586 votes
7 answers
529k views

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 ...
AeroCross's user avatar
  • 6,403
584 votes
11 answers
238k views

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's user avatar
  • 31.8k
581 votes
9 answers
687k views

Can grep output only specified groupings that match?

Say I have a file: # file: 'test.txt' foobar bash 1 bash foobar happy foobar I only want to know what words appear after "foobar", so I can use this regex: "foobar \(\w\+\)" The parenthesis ...
Cory Klein's user avatar
  • 18.9k
577 votes
3 answers
497k views

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''s user avatar
576 votes
7 answers
929k views

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?
user avatar
564 votes
4 answers
1.6m views

In a bash script, using the conditional "or" in an "if" statement

This question is a sequel of sorts to my earlier question. The users on this site kindly helped me determine how to write a bash for loop that iterates over string values. For example, suppose that ...
Andrew's user avatar
  • 16.9k
560 votes
12 answers
1.0m views

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 ...
Psachnodaimonia's user avatar
559 votes
4 answers
677k views

recursive mkdir

Is there a linux command that I'm overlooking that makes it possible to do something along the lines of: (pseudo) $ mkdir -R foo/bar/zoo/andsoforth Or is there no alternative but to make the ...
user avatar
559 votes
14 answers
1.5m views

How to forward X over SSH to run graphics applications remotely?

I have a machine running Ubuntu which I SSH to from my Fedora 14 machine. I want to forward X from the Ubuntu machine back to Fedora so I can run graphical programs remotely. Both machines are on a ...
Mr. Shickadance's user avatar

15 30 50 per page
1
2 3 4 5
4774