Most Popular
1500 questions
238
votes
4 answers
Why are tar archive formats switching to xz compression to replace bzip2 and what about gzip?
More and more tar archives use the xz format based on LZMA2 for compression instead of the traditional bzip2(bz2) compression. In fact kernel.org made a late "Good-bye bzip2" announcement, 27th Dec. 2013, indicating kernel sources would from this…
user44370
237
votes
7 answers
How to move and overwrite subdirectories (and files) to parent directory?
I have a ton of files and dirs in a subdirectory I want to move to the parent directory. There are already some files and dirs in the target directory which need to be overwritten. Files that are only present in the target should be left untouched.…
EricSchaefer
- 2,803
- 2
- 20
- 20
237
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
- 39,295
- 97
- 250
- 349
237
votes
15 answers
umount: device is busy. Why?
When running umount /path I get:
umount: /path: device is busy.
The filesystem is huge, so lsof +D /path is not a realistic option.
lsof /path, lsof +f -- /path, and fuser /path all return nothing. fuser -v /path gives:
USER …
Ole Tange
- 33,591
- 31
- 102
- 198
237
votes
8 answers
Why do I need a tty to run sudo if I can sudo without a password?
I have configured sudo to run without a password, but when I try to ssh 'sudo Foo', I still get the error message sudo: sorry, you must have a tty to run sudo.
Why does this happen and how can I work around it?
merlin2011
- 3,855
- 5
- 27
- 36
231
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,413
- 2
- 7
- 5
231
votes
5 answers
How to use wildcards (*) when copying with scp?
Why can't I copy with scp when I'm using * characters in the path?
scp SERVERNAME:/DIR/* .
What configuration does SCP need in order to allow * in the path?
UPDATE: the problem is not on server side; pscp is trying to use SCPv1, and that's why the…
LanceBaynes
- 39,295
- 97
- 250
- 349
230
votes
4 answers
Do the parent directory's permissions matter when accessing a subdirectory?
If I have a root folder with some restrictive permission, let's say 600, and if the child folders/files have 777 permission will everybody be able to read/write/execute the child file even though the root folder has 600?
Ken Li
- 2,435
- 3
- 16
- 8
229
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:…
Ankit Vashistha
- 3,487
- 12
- 31
- 36
228
votes
4 answers
How can I set "vi" as my default editor in UNIX?
I believe I can do something like export EDITOR=vi, but I'm not sure what exactly to enter, and where.
How can I set "vi" as my default editor?
Donny P
- 2,471
- 3
- 14
- 7
226
votes
7 answers
How can I see dmesg output as it changes?
I'm writing a device driver that prints error message into ring buffer dmesg output.
I want to see the output of dmesg as it changes.
How can I do this?
Milad Khajavi
- 3,117
- 3
- 19
- 16
226
votes
9 answers
Looping through files with spaces in the names?
I wrote the following script to diff the outputs of two directores with all the same files in them as such:
#!/bin/bash
for file in `find . -name "*.csv"`
do
echo "file = $file";
diff $file /some/other/path/$file;
read…
Amir Afghani
- 7,083
- 11
- 26
- 23
224
votes
4 answers
What does <<< mean?
What does <<< mean? Here is an example:
$ sed 's/a/b/g' <<< "aaa"
bbb
Is it something general that works with more Linux commands?
It looks like it's feeding the sed program with the string aaa, but isn't << or < usually used for that?
Daniel Jonsson
- 2,395
- 3
- 14
- 9
224
votes
3 answers
How do I remove a directory and all its contents?
In bash all I know is that
rmdir directoryname
will remove the directory but only if it's empty. Is there a way to force remove subdirectories?
Piper
- 2,535
- 2
- 19
- 15
224
votes
6 answers
How can I populate a file with random data?
How can I create a new file and fill it with 1 Gigabyte worth of random data? I need this to test some software.
I would prefer to use /dev/random or /dev/urandom.
Stefan Lasiewski
- 19,264
- 24
- 70
- 85