Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs.
128
votes
11answers
38k 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 ...
73
votes
3answers
20k 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 ...
51
votes
15answers
40k 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 ...
45
votes
6answers
42k 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 ...
43
votes
3answers
3k 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 ...
39
votes
9answers
26k 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 ...
35
votes
52answers
4k views
Favorite Unix command line aliases? [closed]
What are your favorite command line aliases (bash/sh/tcsh) aliases? Here are a few of mine.
alias lsr='ls -lrt'
alias gon='cd $HOME/Notes'
alias devdb='mysql -h dev --user=x --password=secret ...
35
votes
10answers
7k views
Learning to compile things from source (on Unix/Linux/OSX)
While I install software from packages (MacPorts / apt-get) where-ever possible, I often find myself needing to compile packages from source. ./configure && make && sudo make install ...
34
votes
30answers
4k views
Command line safety tricks [closed]
Command line and scripting is dangerous. Make a little typo with rm -rf and you are in a world of hurt. Confuse prod with stage in the name of the database while running an import script and you are ...
34
votes
15answers
6k views
Favorite rsync tips and tricks
The more I use rsync the more I realise that it's a swiss army knife of file transfer. There are so many options. I recently found out that you can go --remove-source-files and it'll delete a file ...
32
votes
42answers
5k views
Tools a Unix administrator cannot live without [closed]
After administering Unix or Unix-like servers, what tools (command-line preferably) do you feel you cannot live without?
32
votes
9answers
30k 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 ...
32
votes
1answer
11k views
How do I change my private key passphrase?
I have an existing public/private key pair, the private key is password protected, the encryption may be either RSA or DSA. These keys are the kind you generate with ssh-keygen and generally store ...
30
votes
2answers
3k views
Why do I have to edit /etc/sudoers with visudo?
I've noticed that the sudoers file and cron config files act in a special way compared to other config files on Linux. They need to be edited with a special wrapper rather than any text editor. Why is ...
30
votes
4answers
12k views
Drawbacks of mounting a filesystem with noatime?
Having every file be updated just when accessing them sounds like a waste.
What's the catch with mounting a file system with the noatime option. What kind of applications/servers relies on the access ...
28
votes
8answers
18k 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 ...
28
votes
11answers
864 views
Best practices for keeping UNIX packages up to date?
How do you keep your servers up to date?
When using a package manager like Aptitude, do you keep an upgrade / install history, and if so, how do you do it?
When installing or upgrading packages on ...
27
votes
8answers
15k views
24
votes
4answers
13k views
How to convert text file from Windows line breaks to Unix ones on Unix/Linux?
Is there a quick way to convert text file from Unix line breaks to Windows ones in Unix environment? I thought there could be a standard utility.
23
votes
6answers
3k views
How to determine the “age” of a linux system since installation?
any ideas please ? first off I thought that I could easily check the timestamp of particular files, but then I realized that it wouldn't be so easy when I saw timestamps like 1991 :-)
20
votes
8answers
18k views
How to reduce memory usage on a Unix webserver
I'm currently using a Joyent Accelerator to host my webapps, and it's working fine, however I need to reduce costs so I'm downgrading my current plan and that imposes some new memory limits (256M rss, ...
19
votes
5answers
3k views
What do these abbreviations stand for?
Some directories are easy to understand the meaning
/usr
/bin
...
But for the next ones, I have no idea.
/etc
/opt
opt for optional?
etc for electronic t...... configuration (no idea for t)
I ...
18
votes
4answers
2k views
In tail -f, how do I filter out stuff that has certain keywords?
I want to tail -f my logs. However, I want to filter out everything that has the words:
"ELB", "Pingdom", "Health"
18
votes
5answers
1k views
Turning off atime on a filesystem
I am setting up a mongoDB replica set and one of the first things I am suppose to do is turn off atime on the file system. After researching this a bit, I am not opposed to doing this, but I have to ...
16
votes
4answers
1k views
What is the first digit for in 4-digit octal Unix file permission notation?
3-digit:
644
ugo (user group other)
4-digit:
0644
?ugo (??? user group other)
What is the first octal digit for in 4-digit octal Unix file permission notation?
16
votes
6answers
4k views
Meaning of directories on Unix and Unix like systems
I've been using Linux for a couple of years now but I still haven't figured out what the origin or meaning of some the directory names are on Unix and Unix like systems. E.g. what does etc stand for ...
15
votes
10answers
3k views
I just did a chmod -x chmod
So I did a chmod -x chmod. How I can fix this problem? How do I give execute rights back to chmod?
15
votes
2answers
1k views
Why is Linux reporting “free” memory strangely?
This is a canonical question about how Unix operating systems report memory usage.
Similar Questions:
Server refuses to use swap partition
Memory Usage in LINUX
I have production ...
15
votes
9answers
7k views
Is it feasible to have home folder hosted with NFS?
I'm planning to deploy some kiosk computers and would like to leave them with a small pendrive as boot disk, keeping the rest at an easy to back up server, ala LTSP.
Right now I'm pondering two ...
15
votes
2answers
10k views
What is the sticky bit in UNIX file systems? When is it used?
What is the sticky bit in a UNIX file system?
As an admin when and how would you use it?
14
votes
6answers
8k views
What does 'set -e' do, and why might it be considered dangerous?
This question has appeared on a pre-interview quiz and it's making me crazy. Can anyone answer this and put me at ease? The quiz has no reference to a particular shell but the job description is for a ...
14
votes
4answers
12k views
How to pipe stderr without piping stdout
How do I pipe the standard error stream without piping the standard out stream?
I know this command works, but it also writes the standard out.
Command 2>&1 | tee -a $LOG
How do I get ...
14
votes
3answers
11k views
How to sort ps output by process start time?
Is there a way to sort ps output by process start time, so newest are either at the top or bottom ?
On Linux ?
On SysV5 ?
On Mac ?
14
votes
4answers
1k views
What's the best way to clean up after a fork bomb?
$ ls
bash: no more processes
Uh oh. Looks like someone made a fork bomb. Where I used to work, this pretty much meant that the shared server would need to be power-cycled, since even the sysadmins ...
14
votes
3answers
3k views
To fsck or not fsck after 180 days
By default after 180 days or some number of mounts, most Linux filesystems force a file system check (fsck). Of course this can be turned off using, for example, tune2fs -c 0 -i 0 on ext2 or ext3.
On ...
13
votes
21answers
17k views
Finding the Public IP address in a shell script
I can find my IP address using ifconfig or hostname -i command.
But how do I find my Public IP?
(I have a static public IP but I want to find it out using unix command)
13
votes
10answers
5k views
Alternative to Daemontools (djbtools) to supervise unix processes?
I've used Daemontools to provide a simple and reliable way to supervise Unix services on my servers. It works well, but it requires a different way of thinking (The DJB Way) and some common complaints ...
13
votes
3answers
964 views
When should I use “nohup”, and when should I use “&”?
I never know when's the best time to use nohup and the & at the end of the command.
13
votes
8answers
3k views
How many and which partitions should I create for a linux server?
Partitions are very important on Linux server because it give you a lot of flexibility, for example when upgrading to a bigger hard drive.
But, how many partitions should I create when building a ...
13
votes
3answers
5k views
How i configure monit to start a process with a determinated user?
Monit runs with root, but i don't want to start my processes as root.. like mysql, mongrel, apache..
12
votes
7answers
11k views
Why can't you fsck a mounted partition?
It's well-known that you should never fsck a mounted partition. I can understand how this could easily lead to corruption if the filesystem is written to by fsck (e.g., the -a option is used), but why ...
12
votes
6answers
8k views
What's the maxium number of files a Unix folder can hold?
What's the maxium number of files a Unix folder can hold?
I think it will be the same as the number of files.
12
votes
6answers
25k views
How to get e-mail from (failed) cron-jobs in Ubuntu?
I create cron-jobs in Ubuntu by placing the executable in one of /etc/cron.{daily,hourly,monthly,weekly}. There are lots of directories starting with cron:
kent@rat:~$ ls -ld /etc/cron*
drwxr-xr-x 2 ...
12
votes
7answers
3k views
Is there a way to redirect output to a file without buffering on unix/linux?
I have a long running batch process that outputs some debug and process information to stdout.
If I just run from a terminal I can keep track of 'where it is' but then the data gets too much and ...
12
votes
4answers
1k views
Can you have more than one ~/.ssh/config file?
We have a bastion server that we use to connect to multiple hosts, and our .ssh/config has grown to over a thousand lines (we have hundreds of hosts that we connect to). This is beginning to get a ...
12
votes
2answers
3k views
Unix socket vs TCP/IP host:port
Could someone please describe to me the pros and cons of using a Unix socket file vs a tcp/ip localhost:port when setting up services on a server (Ubuntu, FWIW)?
In this particular instance it's for ...
12
votes
4answers
2k views
Log transport and aggregation at scale
How're you analysing log files from UNIX/Linux machines? We run several hundred servers which all generate their own log files, either directly or through syslog. I'm looking for a decent solution to ...
11
votes
14answers
1k views
Why pay for UNIX?
I'm fairly new to Unicies. With the advent of GNU/Linux and BSDs, what are the reasons for companies to prefer AIX, Solaris and other commercial systems?
11
votes
4answers
1k views
how many user accounts can a unix-like OS host?
Let's say I want to have a server with as many user accounts as possible. How many is the max?
I want millions of user accounts. Is that crazy? I'd host dozens of load-balance mirrors of the box, ...
11
votes
4answers
3k views
Bash Loop - How to stop the loop when I press Control-C inside a command?
I am rsyncing a few directories. I have a bash terminal open and am executing something like this:
for DIR in * ; do rsync -a $DIR example.com:somewhere/ ; done
However if I want to stop the whole ...
