Most Popular

1500 questions
258
votes
6 answers

What does ` (backquote/backtick) mean in commands?

I came across the following command: sudo chown `id -u` /somedir and I wonder: what is the meaning of the ` symbol. I noticed for instance that while the command above works well, the one below does not: sudo chown 'id -u' /somedir
gws
  • 2,691
258
votes
4 answers

What does aux mean in `ps aux`?

ps aux seems to conveniently list all processes and their status and resource usage (Linux/BSD/MacOS), however I cannot comprehend the meaning of parameter aux using man ps. What does aux mean?
Howard
  • 5,209
258
votes
10 answers

Getting 256 colors to work in tmux

I have 256 colors working just fine in konsole,. I thought I'd give tmux a try because, unlike screen, it seems to support vi mode. However I find that the colors of my prompt show up and this is most likely because I have a 256 color mode prompt.…
xenoterracide
  • 59,188
  • 74
  • 187
  • 252
257
votes
6 answers

Can grep return true/false or are there alternative methods

As a part of this script, I need to be able to check if the first argument given matches the first word of file. If it does, exit with an error message; if it doesn't, append the arguments to the file. I understand how to write the if statement, but…
Lauren
  • 2,635
256
votes
3 answers

Difference between 2>&-, 2>/dev/null, |&, &>/dev/null and >/dev/null 2>&1

Just looking for the difference between 2>&- 2>/dev/null |& &>/dev/null >/dev/null 2>&1 and their portability with non-Bourne shells like tcsh, mksh, etc.
Det
  • 2,682
256
votes
12 answers

How can I calculate the size of a directory?

How to know the size of a directory? Including subdirectories and files.
Juanjo Conti
  • 2,723
254
votes
14 answers

Find the total size of certain files within a directory branch

Assume there's an image storage directory, say, ./photos/john_doe, within which there are multiple subdirectories, where many certain files reside (say, *.jpg). How can I calculate a summary size of those files below the john_doe branch? I tried du…
mbaitoff
  • 5,101
253
votes
4 answers

Why is FreeBSD deprecating GCC in favor of Clang/LLVM?

So I was surfing the net and stumbled upon this article. It basically states that FreeBSD, starting from Version 10 and above will deprecate GCC in favor of Clang/LLVM. From what I have seen around the net so far, Clang/LLVM is a fairly ambitious…
NlightNFotis
  • 7,575
253
votes
16 answers

Merging folders with mv?

If I use mv to move a folder called "folder" to a directory that already contains "folder" will they merge or will it be replaced?
Dominique
  • 5,235
252
votes
14 answers

How to recursively find the amount stored in directory?

I know you are able to see the byte size of a file when you do a long listing with ll or ls -l. But I want to know how much storage is in a directory including the files within that directory and the subdirectories within there, etc. I don't want…
Rob Avery IV
  • 3,155
252
votes
20 answers

How can I get distribution name and version number in a simple shell script?

I'm working on a simple bash script that should be able to run on Ubuntu and CentOS distributions (support for Debian and Fedora/RHEL would be a plus) and I need to know the name and version of the distribution the script is running (in order to…
Alix Axel
  • 2,929
252
votes
5 answers

What is the 'working directory' when cron executes a job?

I have a script that works when I run it from the command line, but when I schedule it with cron I get errors that it cannot find files or commands. My question is twofold: When I schedule a cron job using crontab -e, does it use my user ID as the…
251
votes
2 answers

Unzipping a .gz file without removing the gzipped file

I have a file file.gz, when I try to unzip this file by using gunzip file.gz, it unzipped the file but only contains extracted and removes the file.gz file. How can I unzip by keeping both unzipped file and zipped file?
jack
  • 3,893
250
votes
9 answers

How to delete directories based on `find` output?

I issue the following command to find the .svn directories: find . -name ".svn" That gives me the following results: ./toto/.svn ./toto/titi/.svn ./toto/tata/.svn How could I process all these lines with rm -fr in order to delete the directories…
Arnaud
  • 2,611
250
votes
5 answers

How to rsync only new files

I am trying to set up rsync to synchronize my main web server to the remote server by adding newly generated file to the latter. Here is the command that I use: rsync -avh --update -e "ssh -i /path/to/thishost-rsync-key"…
supermario
  • 3,269