Most Popular

1500 questions
278
votes
8 answers

How to determine where an environment variable came from?

I have a Linux instance that I set up some time ago. When I fire it up and log in as root there are some environment variables that I set up but I can't remember or find where they came from. I've checked ~/.bash_profile, /etc/.bash_rc, and all…
Joel
  • 2,883
  • 3
  • 16
  • 5
277
votes
7 answers

Find out current working directory of a running process?

What command(s) can one use to find out the current working directory (CWD) of a running process? These would be commands you could use externally from the process.
slm
  • 363,520
  • 117
  • 767
  • 871
277
votes
19 answers

How to add a newline to the end of a file?

Using version control systems I get annoyed at the noise when the diff says No newline at end of file. So I was wondering: How to add a newline at the end of a file to get rid of those messages?
k0pernikus
  • 14,853
  • 21
  • 58
  • 79
276
votes
2 answers

how can I recursively delete empty directories in my home directory?

Possible Duplicate: How to remove all empty directories in a subtree? I create directories very often, scattered over my home directory, and I find it very hard to locate and delete them. I want any alias/function/script to find/locate and delete…
Santosh Kumar
  • 3,753
  • 6
  • 28
  • 36
276
votes
2 answers

Kernel inotify watch limit reached

I'm currently facing a problem on a linux box where as root I have commands returning error because inotify watch limit has been reached. # tail -f /var/log/messages [...] tail: cannot watch '/var/log/messages': No space left on device #…
Ultraspider
  • 3,043
  • 4
  • 16
  • 9
275
votes
8 answers

Convince apt-get *not* to use IPv6 method

The ISP I work at is setting up an internal IPv6 network in preparation for eventually connecting to the IPv6 internet. As a result, several of the servers in this network now try to connect to security.debian.org via its IPv6 address by default…
Shadur
  • 30,641
  • 11
  • 58
  • 69
275
votes
18 answers

How do you sort du output by size?

How do you sort du -sh /dir/* by size? I read one site that said use | sort -n but that's obviously not right. Here's an example that is wrong. [~]# du -sh /var/* | sort -n 0 /var/mail 1.2M /var/www 1.8M /var/tmp 1.9G /var/named 2.9M …
xenoterracide
  • 57,918
  • 74
  • 184
  • 250
273
votes
8 answers

Extract only a specific file from a zipped archive to a given directory

I need to extract a single file from a ZIP file which I know the path to. Is there a command like the following: unzip -d . myarchive.zip path/to/zipped/file.txt Unfortunately, the above command extracts and recreates the entire path to the file at…
Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311
270
votes
13 answers

Execute a command once per line of piped input?

I want to run a java command once for every match of ls | grep pattern -. In this case, I think I could do find pattern -exec java MyProg '{}' \; but I'm curious about the general case - is there an easy way to say "run a command once for every line…
Xodarap
  • 3,613
  • 3
  • 20
  • 16
270
votes
5 answers

How to use find command to search for multiple extensions

I can get all jpg images by using: find . -name "*.jpg" But how can I add png files to the results as well?
wong2
  • 3,493
  • 3
  • 17
  • 8
270
votes
3 answers

What is the purpose of .bashrc and how does it work?

I found the .bashrc file and I want to know the purpose/function of it. Also how and when is it used?
Pandya
  • 23,898
  • 29
  • 92
  • 144
269
votes
6 answers

What do the flags in /proc/cpuinfo mean?

How can I tell whether my processor has a particular feature? (64-bit instruction set, hardware-assisted virtualization, cryptographic accelerators, etc.) I know that the file /proc/cpuinfo contains this information, in the flags line, but what do…
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
269
votes
34 answers

Markdown Viewer

I found a file formatted with Markdown. Could you suggest what viewer I could use to view this type of file? Hopefully one without a GUI, if it's possible. I am looking for a viewer that could parse markdown file format that does not need any…
Amree
  • 3,037
  • 4
  • 19
  • 14
269
votes
8 answers

Where did the "wheel" group get its name?

The wheel group on *nix computers typically refers to the group with some sort of root-like access. I've heard that on some *nixes it's the group of users with the right to run su, but on Linux that seems to be anyone (although you need the root…
Michael Mrozek
  • 91,316
  • 38
  • 238
  • 232
268
votes
3 answers

Get file created/creation time?

Possible Duplicate: How do I do a ls and then sort the results by date created? Is there a command in Linux which displays when the file was created ? I see that ls -l gives the last modified time, but can I get the created time/date?
linuxAddict