Most Popular

1500 questions
80
votes
2 answers

Slash and backslash in sed

I want to use sed to change a slash into a backslash and a slash, i.e. / -> \/. But it does not work. Here a small example: #!/bin/bash TEST=/etc/hallo echo $TEST echo $TEST | sed "s/hallo/bello/g" echo $TEST | sed "s/\//\\\//g" The output of the…
devopsfun
  • 1,407
80
votes
8 answers

How To Install Virtualbox Guest Additions On CentOS via Command Line only

Reading the Virtualbox user manual, I finally got [here], which explains how to install Virtualbox Guest Additions on a Linux guest via Command Line. But it's not clear enough for me (I just started learning some commands). Can someone put down the…
its_me
  • 13,959
80
votes
7 answers

How can I set customise settings for htop?

Occasionally, I need to check resources on several machines throughout our data centres for consolidation recommendations. I prefer htop primarily because of the interactive feel and the display. Is there a way to customise some settings to my setup…
MrDuk
  • 1,597
80
votes
6 answers

protocol version mismatch (client 8, server 6) when trying to upgrade

I'm trying to upgrade to a newer version (that has a bug fix) than my current 1.6. I am on Ubuntu and recently upgraded to Ubuntu 13.04. Ideally I want to use tmux version 1.8 or even 1.9. I've downloaded newer versions but can't get them working. I…
80
votes
18 answers

Removing a directory from PATH

I'm trying to compile wxWidgets using MingW, and I have cygwin in my path, which seems to conflict. So I would like to remove /d/Programme/cygwin/bin from the PATH variable and I wonder if there is some elegant way to do this. The naive approach…
Devolus
  • 921
80
votes
2 answers

Output from ls has newlines but displays on a single line. Why?

I think I may be overlooking a relatively fundamental point regarding shell. Output from the ls command by default separates output with newlines, but the shell displays the output on a single line. Can anyone explain this to me? I had always…
79
votes
14 answers

Unix file naming convention

I was wondering what is the naming convention for files in Unix? I am not sure about this, but I think there is perhaps a universal naming convention that one should follow? For example, I want to name a file say: backup with part 2 and random…
user4740
79
votes
2 answers

What units of time does "top" use?

If I issue the "top" command and receive results such as: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 00001 bob 25 0 77380 1212 1200 R 95.8 0.0 89122:13 fee 00002 bob 25 0 77380 1196 1184 R 95.4 0.0 …
Abe
  • 1,681
79
votes
12 answers

Mount Google Drive in Linux?

Now that Google Drive is available, how do we mount it to a Linux filesystem? Similar solutions exist for Amazon S3 and Rackspace Cloud Files.
blee
  • 1,342
79
votes
2 answers

Need explanation on Resident Set Size/Virtual Size

I found that pidstat would be a good tool to monitor processes. I want to calculate the average memory usage of a particular process. Here is some example output: 02:34:36 PM PID minflt/s majflt/s VSZ RSS %MEM Command 02:34:37 PM …
Flanfl
  • 965
79
votes
9 answers

Correctly determining memory usage in Linux

I'm a bit confused on some of the results I am seeing from ps and free. On my server, this is the result of free -m [root@server ~]# free -m total used free shared buffers cached Mem: 2048 2033 …
79
votes
15 answers

Checking if HyperThreading is enabled or not?

How can I check if hyperthreading is enabled on a Linux machine, using a perl script to check for it? I'm trying the following way: dmidecode -t processor | grep HTT Let me know if I'm on right track.
doubledecker
  • 1,807
  • 3
  • 15
  • 13
79
votes
5 answers

How to list the open file descriptors (and the files they refer to) in my current bash session

I am running in an interactive bash session. I have created some file descriptors, using exec, and I would like to list what is the current status of my bash session. Is there a way to list the currently open file descriptors?
blueFast
  • 1,258
79
votes
5 answers

Difference between "cat" and "cat <"

I was working through a tutorial and saw use of both cat myfile.txt and cat < myfile.txt. Is there a difference between these two sequences of commands? It seems both print the contents of a file to the shell.
rookie
  • 833
79
votes
6 answers

How to create a TCP listener?

Introduction: I have created a bash function that is able to check whether a port is available and increments it by 1 if false until a certain maximum port number. E.g., if port 500 is unavailable then the availability of 501 will be checked until…
030
  • 1,557