Most Popular
1500 questions
117
votes
14 answers
tar --exclude doesn't exclude. Why?
I have this very simple line in a bash script which executes successfully (i.e. producing the _data.tar file), except that it doesn't exclude the sub-directories it is told exclude via the --exclude option:
/bin/tar -cf /home/_data.tar …

ateiob
- 1,717
117
votes
4 answers
Does sort support sorting a file in-place, like `sed --in-place`?
Am I blind or is there no option like --in-place for sort?
In order to save results to the input file, sed uses -i (--in-place).
Redirecting the output of sort to the input file
sort < f > f
results in making it empty. If there is no --in-place…

Grzegorz Wierzowiecki
- 14,264
117
votes
8 answers
SED: insert text after the last line?
This sed command inserts a tag to the beginning of a file:
sed -i "1s/^/
user2362
117
votes
6 answers
How can I find available network interfaces?
This is in regard to linux, but if anyone knows of a general *nix method that would be good.
I booted a system yesterday with an ethernet cable plugged in. "NetworkManager" is not installed, so once it started I went to look for the name of the…

goldilocks
- 87,661
- 30
- 204
- 262
117
votes
2 answers
How do keyboard input and text output work?
Suppose I press the A key in a text editor and this inserts the character a in the document and displays it on the screen. I know the editor application isn't directly communicating with the hardware (there's a kernel and stuff in between), so what…

Gilles 'SO- stop being evil'
- 829,060
117
votes
3 answers
How do I time a specific command?
(The linux equivalent of TimeThis.exe)
Something like:
timethis wget foo.com
Receiving foo.com
...
wget foo.com took 3 seconds.

ripper234
- 31,763
116
votes
3 answers
What is difference between User space and Kernel space?
Is Kernel space used when Kernel is executing on the behalf of the user program i.e. System Call? Or is it the address space for all the Kernel threads (for example scheduler)?
If it is the first one, than does it mean that normal user program…

Poojan
- 1,271
116
votes
4 answers
Create a symbolic link relative to the current directory
I'm trying to create a symbolic link in my home directory that points to a directory on my external HDD.
It works fine when I specify it like this:
cd ~
ln -s /run/media/name/exhdd/Data/ Data
However it creates a faulty link when I try this:
cd…

jcora
- 3,884
- 7
- 36
- 54
116
votes
5 answers
How to avoid the need to issue "y" several times when removing protected file
I'm looking for a solution to be used as
a response to "rm: remove write-protected regular file [x] ?"
I was thinking of issuing a character followed by carriage return for several amount of times, in bashrc. How do we do that?

Iancovici
- 1,282
116
votes
3 answers
What are correct permissions for /tmp ? I unintentionally set it all public recursively
I have created a really really short life temporary directory that I wanted to share between some users for a few hours : /some/path/tmp
Unfortunately I have launched sudo chown 777 -R /tmp instead of sudo chown 777 -R tmp, so my /tmp file is now…

Stephane Rolland
- 4,227
116
votes
7 answers
How to extract only a specific folder from a zipped archive to a given directory?
How does one extract a specific folder from a zipped archive to a given directory?
I tried using
unzip "/path/to/archive.zip" "in/archive/folder/" -d "/path/to/unzip/to"
but that only creates the folder on the path I want it to unzip to and does…

Obsidian Jackal
- 1,428
116
votes
9 answers
Why is the root directory on a web server put by default in "/var/www"?
Tuxfiles says the following about the Linux directory structure:
/var:
This directory contains variable data that changes constantly when the system is running.
FHS on /var says the following:
/var contains variable data files. This includes…

jonallard
- 1,626
116
votes
8 answers
Bash: Assign output of pipe to a variable
I am trying to get the output of a pipe into a variable. I tried the following things:
echo foo | myvar=$(

Parckwart
- 1,161
116
votes
5 answers
How to list all loadable kernel modules?
I'm looking for a few kernel modules to load i2c-dev and i2c-bcm2708. But the modprobe command returns:
sudo modprobe i2c-dev
modprobe: module i2c-dev not found in modules.dep
How do I list all the available modules in the system? In which…

UserK
- 2,424
116
votes
5 answers
How to add/update a file to an existing tar.gz archive?
Is there a way to add/update a file in a tar.gz archive? Basically, I have an archive which contains a file at /data/data/com.myapp.backup/./files/settings.txt and I'd like to pull that file from the archive (already done) and push it back into the…

Naftuli Kay
- 39,676