Most Popular

1500 questions
137
votes
5 answers

Difference between /bin and /usr/bin

I read this up on this website and it doesn't make sense. http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/basic/node32.html When UNIX was first written, /bin and /usr/bin physically resided on two different disks: /bin being on a smaller…
whoami
  • 3,750
  • 7
  • 27
  • 26
137
votes
7 answers

How can I monitor all outgoing requests/connections from my machine?

My machine is a server so I want to ignore connections being made to my server (e.g. when someone visits my website). I want to see only connections/requests being made by my server to other places. How do I see only those outgoing…
trusktr
  • 4,035
  • 7
  • 29
  • 34
137
votes
4 answers

How do you detach the 2nd screen from within another screen?

I've accidentally attached to a 2nd GNU screen session from within an existing screen session and cannot detach or issue commands to the inner screen. I remember figuring out how to do that before but completely forgot and would like to keep it as…
Artem Russakovskii
  • 1,505
  • 2
  • 9
  • 9
137
votes
18 answers

Quickly calculate date differences

I often want to make some quick date calculations, such as: What is the difference between these two dates? What is the date n weeks after this other date? I usually open a calendar and count the days, but I think there should be a program/script…
daniel kullmann
  • 9,427
  • 11
  • 38
  • 45
137
votes
10 answers

How to get scp to copy the file instead of its symlink

I want to scp a file to a server. The file is a symbolic link, and actually what I want to do is copy the source file. I don't want to track the source file's path manually, because it can be replaced. How do I get the source file's absolute path so…
Eonil
  • 4,607
  • 11
  • 30
  • 30
137
votes
4 answers

Copy the contents of a file into the clipboard without displaying its contents

How to copy the contents of a file in UNIX without displaying the file contents. I don't want to cat or vi to see the contents. I want to copy them to clipboard so that I can paste it back on my windows notepad. I can't copy the file from that…
Web Nash
  • 2,223
  • 4
  • 15
  • 11
137
votes
7 answers

How do I clear the terminal History?

I am using Linux Mint 17.1 Rebecca for about 2 days and accidentally typed my password into the terminal which is now displayed in the history list of commands I have previously typed. I want to clear the terminal history completely. I have tried…
Shambhala
  • 1,473
  • 2
  • 10
  • 7
137
votes
2 answers

How to uninstall a .deb installed with dpkg?

I installed Unified Remote using dpkg: dpkg -i urserver.deb How do I uninstall it so I can reinstall from scratch?
Tomblarom
  • 2,007
  • 4
  • 15
  • 18
137
votes
3 answers

grep on a variable

Let's say I have a variable line="This is where we select from a table." now I want to grep how many times does select occur in the sentence. grep -ci "select" $line I tried that, but it did not work. I also tried grep -ci "select" "$line" It…
gkmohit
  • 3,219
  • 8
  • 27
  • 30
137
votes
7 answers

Redirecting stdout to a file you don't have write permission on

When you attempt to modify a file without having write permissions on it, you get an error: > touch /tmp/foo && sudo chown root /tmp/foo > echo test > /tmp/foo zsh: permission denied: /tmp/foo Sudoing doesn't help, because it runs the command as…
Michael Mrozek
  • 91,316
  • 38
  • 238
  • 232
137
votes
4 answers

Why are there so many different ways to measure disk usage?

When I sum up the sizes of my files, I get one figure. If I run du, I get another figure. If I run du on all the files on my partition, it doesn't match what df claims is used. Why are there so many different figures for the total size of my files?…
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
137
votes
3 answers

Getting new files to inherit group permissions on Linux

I am having a problem with permissions on a Linux server. I am used to BSD. When a directory is owned by a group the user who owns it isn't in such as www-data, files created in it will be owned by that group. This is important because I want files…
John Tate
  • 1,900
  • 3
  • 21
  • 30
137
votes
12 answers

How to rsync over ssh when directory names have spaces

I am trying to rsync from one server to another. The servers have the same directory structure but I am having trouble getting the remotes server to properly recognize the path name on the remote when there is a space in it. Here are the…
PyNEwbie
  • 1,549
  • 3
  • 11
  • 11
136
votes
3 answers

Pseudo files for temporary data

I often want to feed relatively short string data (could be several lines though) to commandline programs which accept only input from files (e.g. wdiff) in a repeated fashion. Sure I can create one or more temporary files, save the string there and…
highsciguy
  • 2,534
  • 4
  • 21
  • 29
136
votes
9 answers

How to grep lines which does not begin with "#" or ";"?

I want to grep smb.conf and see only lines which are not commented.
denys
  • 1,631
  • 3
  • 12
  • 11