Questions tagged [linux]
Linux is the generic term for a UNIX-like open source operating system based on the Linux kernel.
38,304
questions
1419
votes
39
answers
1.2m
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 -...
782
votes
9
answers
1.1m
views
Can scp copy directories recursively?
Currently I can only copy a single .tar file. But how can I copy directories recursively with scp?
582
votes
3
answers
326k
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 ...
401
votes
20
answers
438k
views
How to run a server on port 80 as a normal user on Linux?
I have Googled about a solution for quite some time, but couldn't find an answer.
I am on Ubuntu Linux and want to run a server on port 80, but due to security mechanism of Ubuntu, I get the ...
382
votes
7
answers
924k
views
Why is my crontab not working, and how can I troubleshoot it?
This is a Canonical Question about using cron & crontab.
You have been directed here because the community is fairly sure that the answer to your question can be found below. If your question is ...
376
votes
20
answers
353k
views
Showing total progress in rsync: is it possible?
I have searched for this option already, but have only found solutions that involve custom patching. The fact that it does not show in --help and no more info can be found probably indicates the ...
371
votes
6
answers
563k
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/.
/var/...
362
votes
5
answers
154k
views
Anyone else experiencing high rates of Linux server crashes during a leap second day?
*NOTE: if your server still has issues due to confused kernels, and you can't reboot - the simplest solution proposed with gnu date installed on your system is: date -s now. This will reset the ...
340
votes
4
answers
165k
views
What are the functional differences between .profile .bash_profile and .bashrc
What are the functional differences between the .profile, .bash_profile and .bashrc files?
337
votes
18
answers
426k
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 ...
336
votes
27
answers
536k
views
Can I automatically add a new host to known_hosts?
Here's my situation: I'm setting up a test harness that will, from a central client, launch a number of virtual machine instances and then execute commands on them via ssh. The virtual machines will ...
312
votes
8
answers
760k
views
How to bind MySQL server 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.
294
votes
8
answers
1.3m
views
Check if port is open or closed on a Linux server?
How can I check if a port is listening on a Linux server?
283
votes
13
answers
99k
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 ...
275
votes
3
answers
207k
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 ...
271
votes
2
answers
85k
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 (reinstall OS)...
266
votes
2
answers
313k
views
Linux command to inspect TXT records of a domain [closed]
Is there a linux shell command that I can use to inspect the TXT records of a domain?
266
votes
5
answers
203k
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 ...
262
votes
11
answers
266k
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 ...
252
votes
10
answers
316k
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 ...
245
votes
13
answers
154k
views
Environment variables of a running process on Unix?
I need to troubleshoot some problems related to environment variables on a Unix system.
On Windows, I can use a tool such as ProcessExplorer to select particular a process and view values of each ...
241
votes
10
answers
334k
views
How to run a command multiple times, using bash shell?
Is there a way to run a command (e.g. ps aux|grep someprocess) for n times?
Something like:
run -n 10 'ps aux|grep someprocess'
I want to use it interactively.
Update: The reason I am asking this is,...
238
votes
16
answers
460k
views
df in linux not showing correct free space after file removal
I have file servers which are used to store files. Files might reside there for a week, or for a year. Unfortunately, when I remove files from the server, df command doesn't reflect the freed up space....
234
votes
4
answers
182k
views
What's the best way of handling permissions for Apache 2'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 Apache 2 user is www-data.
We've got two regular users & root. So when messing with ...
231
votes
19
answers
284k
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 my /etc/hosts/ file?
If it's not possible, how do I work around this problem? I need ...
228
votes
17
answers
720k
views
Permission denied (publickey). SSH from local Ubuntu to Amazon EC2 server
I have an instance of an application running in the cloud on an Amazon EC2 instance, and I need to connect to it from my local Ubuntu. It works fine on one local ubuntu and also laptop. I got this ...
227
votes
3
answers
237k
views
How do I do 'mount --bind' in /etc/fstab?
I'm trying to add mount --bind /proc/ /chroot/mysql/proc to /etc/fstab. How can I do this?
226
votes
10
answers
536k
views
How to check if a library is installed?
In Linux, how do I check if a library is installed or not? (from the command line of course).
In my specific case now, I want to check whether libjpeg is installed.
226
votes
8
answers
258k
views
When does /tmp get cleared?
I'm taking to putting various files in /tmp, and I wondered about the rules on deleting them?
I'm imagining it's different for different distributions, and I'm particularly interested in Ubuntu and ...
222
votes
14
answers
404k
views
Shell command to monitor changes in a file
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 ...
217
votes
8
answers
343k
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 ...
208
votes
8
answers
335k
views
How to setup passwordless `sudo` on Linux?
How can passwordless sudo access be setup on either RHEL (Fedora, CentOS, etc) or Ubuntu distributions? (If it's the same across distros, that's even better!)
Setting: personal and/or lab/training ...
206
votes
15
answers
355k
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 ...
206
votes
5
answers
196k
views
Difference in sites-available vs sites-enabled vs conf.d directories (Nginx)?
I have some experience using linux but none using nginx. I have been tasked with researching load-balancing options for an application server.
I have used apt-get to install nginx and all seems ...
202
votes
4
answers
278k
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
Swap:...
196
votes
6
answers
63k
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 ...
196
votes
22
answers
110k
views
Is it normal to get hundreds of break-in attempts per day?
I just checked my server's /var/log/auth.log and found that I'm getting over 500 failed password/break-in attempt notifications per day! My site is small, and its URL is obscure. Is this normal? ...
195
votes
6
answers
84k
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 ...
193
votes
6
answers
207k
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.
edit:...
193
votes
3
answers
193k
views
What does a + mean at the end of the permissions from ls -l?
What is the plus sign at the end of the permissions telling me?
ls -l
total 4
drwxrwxrwx+ 2 benson avahi-autoipd 4096 Jan 27 17:37 docs
Here's the context:
cat /etc/issue
\CentOS release 5.3 (Final)...
192
votes
15
answers
336k
views
How to know from which yum repository a package has been installed?
After I have installed a package by yum (with multiple repositories configured), how can I find from which repository it has been installed?
If I run yum info package-name (or yum list package-name), ...
190
votes
4
answers
81k
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 ...
189
votes
6
answers
466k
views
SSL Certificate Location on UNIX/Linux
Is there any standard or convention for where SSL certificates and associated private keys should go on the UNIX/Linux filesystem?
187
votes
10
answers
613k
views
How do I verify the speed of my NIC?
I just installed a new gigabit network interface card (NIC) in Linux. How do I tell if it is really set to gigabit speeds? I see ethtool has an option to set the speed, but I can't seem to figure ...
183
votes
10
answers
301k
views
What is "-bash: !": event not found"
Try executing the following under a bash shell echo "Reboot your instance!"
On my installation:
root@domU-12-31-39-04-11-83:/usr/local/bin# bash --version
GNU bash, version 4.1.5(1)-release (i686-pc-...
182
votes
31
answers
98k
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 ...
179
votes
8
answers
269k
views
Filename length limits on linux?
Are there any filename or path length limits on Linux?
178
votes
8
answers
399k
views
How do I sleep for a millisecond in bash or ksh
sleep is a very popular command and we can start sleep from 1 second:
# wait one second please
sleep 1
but what the alternative if I need to wait only 0.1 second or between 0.1 to 1 second ?
...
175
votes
18
answers
277k
views
Disk full, du tells different. How to further investigate?
I have a SCSI disk in a server (hardware Raid 1), 32G, ext3 filesytem. df tells me that the disk is 100% full. If I delete 1G this is correctly shown.
However, if I run a du -h -x / then du tells me ...
175
votes
9
answers
218k
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 realize ...