Linux is the generic term for a UNIX-like open source operating system based on the Linux kernel.

learn more… | top users | synonyms (3)

189
votes
33answers
62k views

How can I sort du -h output by size

I need to get a list of human readable du output. However, du does not have a "sort by size" option, and piping to "sort" doesn't work with the human readable flag. For example, running: du | sort ...
158
votes
11answers
47k views

Can I nohup/screen an already-started process?

I'm doing some test-runs of long-running data migration scripts, over SSH. Let's say I start running a script around 4 PM; now, 6 PM rolls around, and I'm cursing myself for not doing this all in ...
138
votes
2answers
9k views

Why is “chmod -R 777 /” destructive?

This is a Canonical Question about File Permission and Why 777 is "destructive". I'm not asking how to fix this problem, as there are a ton of references of that already on Server Fault ...
137
votes
39answers
31k views

What useful things can one add to one's .bashrc? [closed]

Is there anything that you can't live without and will make my life SO much easier? Here are some that I use ('diskspace' & 'folders' are particularly handy). # some more ls aliases alias ll='ls ...
127
votes
3answers
81k views

What's the best way of handling permissions for apache2's user www-data in /var/www?

Has anyone got a nice solution for handling files in /var/www/ ? We're running Name Based Virtual Hosts and the apache2 user is 'www-data' We've got two regular users & root. So when messing ...
104
votes
4answers
27k views

LVM dangers and caveats

I have recently started using LVM on some servers for hard drives larger than 1 TB. They're useful, expandable and quite easy to install. However, I could not find any data about the dangers and ...
102
votes
13answers
257k views

Why do I get “Permission denied (publickey)” when trying to SSH from local Ubuntu to a Amazon EC2 server?

I have an instance of an application running in the cloud on Amazon EC2 instance, and I need to connect it from my local Ubuntu. It works fine on one of local ubuntu and also laptop. I got message ...
96
votes
19answers
63k views

How can I run a server on Linux on port 80 as a normal user?

I have googled about it for quite some time, but couldn't find it. I am on Ubuntu Linux and want to run a server on port 80, but due to security mechanism of Ubuntu, I get the following error: ...
94
votes
3answers
30k views

What is the difference between double and single square brackets in bash?

I just wondered what exactly the difference between [[ $STRING != foo ]] and [ $STRING != foo ] is, apart from that the latter is posix-compliant, found in sh and the former is an extension ...
91
votes
23answers
7k views

How do you make it obvious you are on a production system?

A few of us at my company have root access on production servers. We are looking for a good way to make it exceedingly clear when we have ssh'd in. A few ideas we have had are: Bright red prompt ...
91
votes
9answers
130k views

MySQL: Bind to more than one IP address?

Is there a secret way to bind MySQL to more than one IP address? As far as I can see the bind-address parameter in the my.cnf does not support more than one IP and you can't have it more than once.
90
votes
5answers
4k views

How to cd into a directory with this name “-2” (starting with the hyphen)?

I have a directory named: -2 I want to cd into it but the cd complains: bash: cd: -2: invalid option With no success, I've tried: cd "-2" cd '-2' cd \-2 Any solution? Edit: no file browsers ...
84
votes
12answers
11k views

What solutions exist to allow the use of revision control for server configuration files? [closed]

In an environment with multiple system administrators, I see a few advantages to adding the server config files into a revision control system. Most notable are the ability to track changes, who made ...
82
votes
9answers
16k views

Keeping a linux process running after I logout

I'm connecting to a linux machine through SSH, because I'm trying to run a heavy bash script that makes filesystem operations, and it's expected to keep running for hours. But I cannot leave the SSH ...
80
votes
24answers
23k views

How do I prevent accidental rm -rf /*?

I just ran rm -rf /* accidentally, but I meant rm -rf ./* (notice the star after the slash). alias rm='rm -i' and --preserve-root by default didn't save me, so are there any automatic safeguards for ...
71
votes
4answers
12k views

Why is TCP accept() performance so bad under Xen?

The rate at which my server can accept() new incoming TCP connections is really bad under Xen. The same test on bare metal hardware shows 3-5x speed ups. How come this is so bad under Xen? Can you ...
70
votes
4answers
7k views

Should I quit using Ifconfig?

With the servers that mount Infiniband cards, when I use the ifconfig command, I get this warning: Ifconfig uses the ioctl access method to get the full address information, which limits hardware ...
70
votes
2answers
27k views

What exactly do the colors in htop status bars mean?

By default, htop shows colored status bars for processors, memory, and swap. From left to right, the bars are colored green, blue, yellow, and red depending on some thresholds. What does it mean when ...
68
votes
15answers
66k views

Copying a large directory tree locally? cp or rsync?

I have to copy a large directory tree, about 1.8 TB. It's all local. Out of habit I'd use rsync, however I wonder if there's much point, and if I should rather use cp. I'm worried about permissions ...
66
votes
7answers
21k views

Heartbleed: how to reliably and portably check the OpenSSL version?

I was looking at a reliable and portable way to check the OpenSSL version on GNU/Linux and other systems, so users can easily discover if they should upgrade their SSL because of the Heartbleed bug. ...
64
votes
5answers
33k views

What permissions should my website files/folders have on a Linux webserver?

This is a Canonical Question about File Permissions on a Linux web server. I have a Linux web server running Apache2 that hosts several websites. Each website has its own folder in /var/www/. ...
64
votes
2answers
21k views

Why does my hostname appear with the address 127.0.1.1 rather than 127.0.0.1 in /etc/hosts?

This may be a bit of a noobish question, but I was taking a look at /etc/hosts on my new Xubuntu install and saw this: 127.0.0.1 localhost 127.0.1.1 myhostname On most 'nixes I've used, the second ...
62
votes
14answers
3k views

What's wrong with always being root?

I have a feeling this is a stupid question, but this is something I've wondered for awhile. I have a VPS and this is my first big linux venture. I am the only person who has access to it. My question ...
59
votes
6answers
40k views

Setting the hostname: FQDN or short name?

I've noticed that the "preferred" method of setting the system hostname is fundamentally different between Red Hat/CentOS and Debian/Ubuntu systems. CentOS documentation and the RHEL deployment guide ...
58
votes
15answers
8k views

Hundreds of failed ssh logins

Every night I get hundreds, sometimes thousands, of failed ssh logins on my RedHat 4 server. For firewall reasons from remote sites, I need to run on the standard port. Is there anything I should be ...
58
votes
4answers
30k views

Moving an already-running process to Screen

My office job routinely sees me connected to a Linux box via VNC. Sometimes I start a remote job on the console, and realize later that it runs much longer than expected. (Should have started that ...
57
votes
12answers
50k views

In my /etc/hosts/ file on Linux/OSX how do I do a wildcard subdomain?

I need to test sub-domains on my localhost. How can I effectively have this result of adding *.localhost.com to m /etc/hosts/ file? If it's not possible, how do I work around this problem? I need ...
57
votes
7answers
92k views

Apache 2 startup warning: NameVirtualHost *:80 has no VirtualHosts

When my Ubuntu Apache server (Apache 2) starts up I get a warning message that reads: [warn] NameVirtualHost *:80 has no VirtualHosts However, the web server is working fine. What might I have ...
56
votes
7answers
46k views

How can I run Debian stable but install some packages from testing?

Say you're running a server and you don't want to upgrade to Testing (Squeeze) from Stable (Lenny) to just install a required package or two. What's the best way of installing only certain packages ...
56
votes
5answers
7k views

Tips for Securing a LAMP Server

This is a Canonical Question about Securing a LAMP stack What are the absolute guidelines for securing a LAMP server?
56
votes
13answers
25k views

What steps do you take to secure a Debian server?

I am installing a Debian server which is connected directly to the Internet. Obviously I want to make it as secure as possible. I would like you guys/gals to add your ideas to secure it and what ...
54
votes
6answers
60k views

How to forcibly close a socket in TIME_WAIT?

I run a particular program on linux which sometimes crashes. If you open it quickly after that, it listens on socket 49201 instead of 49200 as it did the first time. netstat reveals that 49200 is in ...
53
votes
10answers
38k views

memcache vs memcached?

I want to use memcached http://www.danga.com/memcached/ I have installed it through yum install memcached But now I need to connect to PHP, and there is an extension named memcache and one named ...
50
votes
4answers
55k views

Can scp copy directories?

Now I can only copy a single tar file,how can I copy directories recursively with scp?
49
votes
13answers
50k views

How to reconnect to a disconnected ssh session

Is there a way to connect to an ssh session that was disconnected? We are having problems with our network connection to a remote site that we are working on separately; however, in the mean time we ...
49
votes
5answers
2k views

How should an IT department choose a Linux distribution: Technical reasons

There is a lot of community feeling about what Linux distributions are appropriate for production server environments and what aren't. Some of this is based on the availability of commercial support. ...
49
votes
3answers
34k views

how to disable SSH login with password for some users?

On Linux (Debian Squeeze) I would like to disable SSH login using password to some users (selected group or all users except root). But I do not want to disable login using certificate for them. ...
48
votes
9answers
33k views

Is it possible to detach a process from its terminal? (Or, “I should have used screen!”) [duplicate]

Possible Duplicate: Can I nohup/screen an already-started process? On Unix (specifically, Linux), I've started a job in a regular ssh->bash session. I'd like to leave work soon, but I now ...
48
votes
10answers
43k views

How to know from which yum repository a package has been installed

After I have installed a package by yum (with multiple repository configured), how can I found from which repository it has been installed? If I run yum info package name (or yum list package name), I ...
47
votes
9answers
43k views

Shell command to monitor changes in a file - What's it called again?

I know there was a command on Unix that I could use to monitor a file and see changes that are getting written to it. This was quite useful especially for checking log files. Do you know what it is ...
47
votes
3answers
38k views

Meaning of the buffers/cache line in the output of free

Why does my server show total used free shared buffers cached Mem: 12286456 11715372 571084 0 81912 6545228 -/+ buffers/cache: 5088232 7198224 ...
47
votes
6answers
4k views

What should NOT be managed by puppet?

I'm learning my way through configuration management in general and using puppet to implement it in particular, and I'm wondering what aspects of a system, if any, should not be managed with puppet? ...
46
votes
9answers
54k views

When does `cron.daily` run?

When do entries in cron.daily (and .weekly and .hourly) run, and is it configurable? I haven't found a definitive answer to this, and am hoping there is one. I'm running RHEL5 and CentOS 4, but for ...
46
votes
8answers
86k views

What limits the maximum number of connections on a Linux server?

What kernel parameter or other settings control the maximum number of TCP sockets that can be open on a Linux server? What are the tradeoffs of allowing more connections? I noticed while load testing ...
45
votes
9answers
10k views

What's the difference between apt-get and aptitude?

I don't get why there are two different programs in a minimal install to install software. Don't they do the same thing? Is there a big difference? I have read everywhere to use aptitude over apt-get ...
45
votes
2answers
5k views

Why is it so difficult to upgrade between major versions of Red Hat and CentOS?

"Can we upgrade our existing production EL5 servers to EL6?" A simple-sounding request from two customers with completely different environments prompted my usual best-practices answer of "yes, but ...
44
votes
3answers
4k views

What is the difference between a soft (symbolic) link and a hard link?

I hear that you can now create soft links in Vista too. So, what is the difference between a soft (symbolic) link and a hard link on UNIX/Linux/Vista? Are there advantages of using one over the ...
41
votes
8answers
25k views

Environment variables of a running process on Unix?

This is to troubleshoot some problems related to environment variables .. On Windows, I could do this by using tool such as ProcessExplorer to select particular process and view values of each ...
41
votes
9answers
47k views

How can I export the privileges from MySQL and then import to a new server?

I know how to export/import the databases using mysqldump & that's fine but how do I get the privileges into the new server. For extra points, there are a couple of existing databases on the new ...
41
votes
5answers
3k views

Why is tampering with the TTL of IP dangerous?

I've been reading the iptables man-page (light bedtime reading) and i came across the 'TTL' target, but it warns: Setting or incrementing the TTL field can potentially be very dangerous and ...