Most Popular

1500 questions
250
votes
12 answers

Limit memory usage for a single Linux process

I'm running pdftoppm to convert a user-provided PDF into a 300DPI image. This works great, except if the user provides an PDF with a very large page size. pdftoppm will allocate enough memory to hold a 300DPI image of that size in memory, which…
Ben Dilts
  • 2,603
  • 3
  • 14
  • 5
250
votes
11 answers

Terminal prompt not wrapping correctly

I have an issue where if I type in very long commands in bash the terminal will not render what I'm typing correctly. I'd expect that if I had a command like the following: username@someserver ~/somepath $ ssh -i…
Muricula
  • 2,610
249
votes
6 answers

How to extract specific file(s) from tar.gz

How can we extract specific files from a large tar.gz file? I found the process of extracting files from a tar in this question but, when I tried the mentioned command there, I got the error: $ tar --extract --file={test.tar.gz} {extract11} tar:…
249
votes
5 answers

What does env x='() { :;}; command' bash do and why is it insecure?

There is apparently a vulnerability (CVE-2014-6271) in bash: Bash specially crafted environment variables code injection attack I am trying to figure out what is happening, but I'm not entirely sure I understand it. How can the echo be executed as…
jippie
  • 14,086
248
votes
4 answers

Combined `mkdir` and `cd`?

is there any way (what is the easiest way in bash) to combine the following: mkdir foo cd foo The manpage for mkdir does not describe anything like that, maybe there is a fancy version of mkdir? I know that cd has to be shell builtin, so the same…
Jasper
  • 3,628
247
votes
9 answers

What does etc stand for?

What does the "etc" folder in the root directory stand for? I think knowing this will help me remember where certain files are located. Update: Might be useful for others, the folder is used for "Host specific configuration files" - reference.
David Tang
  • 2,581
247
votes
11 answers

How can I edit multiple files in Vim?

I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time? Also, how can I tell the file name of the current file that I'm editing?
cwd
  • 45,389
246
votes
4 answers

How to export a GPG private key and public key to a file

I have generated keys using GPG, by executing the following command gpg --gen-key Now I need to export the key pair to a file; i.e., private and public keys to private.pgp and public.pgp, respectively.  How do I do it?
rocky
  • 2,563
246
votes
3 answers

Why is 'ls' suddenly wrapping items with spaces in single quotes?

I just noticed that on one of my machines (running Debian Sid) whenever I type ls any file name with spaces has single quotes surrounding it. I immediately checked my aliases, only to find them intact. wyatt@debian630:~/testdir$ ls 'test 1.txt' …
Wyatt Ward
  • 4,032
245
votes
2 answers

There are stopped jobs (on bash exit)

I get the message There are stopped jobs. when I try to exit a bash shell sometimes. Here is a reproducible scenario in python 2.x: ctrl+c is handled by the interpreter as an exception. ctrl+z 'stops' the process. ctrl+d exits python for…
ThorSummoner
  • 4,422
245
votes
8 answers

What's the difference between /sbin/nologin and /bin/false

Technically, unless pam is set up to check your shell with pam_shells neither of these can actually prevent your login, if you're not on the shell. On my system they are even different sizes, so I suspect they actually do something. So what's the…
xenoterracide
  • 59,188
  • 74
  • 187
  • 252
244
votes
4 answers

How can get a list of all scheduled cron jobs on my machine?

My sysadmin has set up a bunch of cron jobs on my machine. I'd like to know exactly what is scheduled for what time. How can I get that list?
Frank
  • 2,781
244
votes
15 answers

How to run a specific program as root without a password prompt?

I need to run something as sudo without a password, so I used visudo and added this to my sudoers file: MYUSERNAME ALL = NOPASSWD: /path/to/my/program Then I tried it out: $ sudo /path/to/my/program [sudo] password for MYUSERNAME: Why does it ask…
LanceBaynes
  • 40,135
  • 97
  • 255
  • 351
244
votes
3 answers

What's the difference between semicolon and double ampersand &&

What is the difference between echo "Hello " ; echo "world" and echo "Hello " && echo "world" Both seems to run the two commands after each other.
lindhe
  • 4,236
  • 3
  • 21
  • 35
244
votes
9 answers

Find where inodes are being used

So I received a warning from our monitoring system on one of our boxes that the number of free inodes on a filesystem was getting low. df -i output shows this: Filesystem Inodes IUsed IFree IUse% Mounted on /dev/xvda1 524288 422613 …
phemmer
  • 71,831