Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs.

learn more… | top users | synonyms

7
votes
9answers
12k views

Bash snippet to move all files in a directory into that directory

I have a directory with lots of files and directories in it. In order to tidy it up, I'm going to put all those files into a directory, so I was going to do something like this: $ ls | wc -l 123 $ ...
7
votes
3answers
4k views

Directory that a user can read, but root can't?

There's a directory underneath my homedir called ".gvfs". As my regular user account, I can read it just fine: ~ $ ls -lart ~raldi/.gvfs total 4 dr-x------ 2 raldi raldi 0 2009-05-25 22:17 . ...
7
votes
3answers
4k views

Non-recursive find on linux

I am trying to find all directories that are directly inside the current directory and older than a specific age. The trick is, I only want to consider the age of the immediate descendants of the ...
7
votes
6answers
3k views

What are a regular maintenance you need to perform on your Linux server?

I have a server that host few websites, I haven't done any maintenance for about 2 month other than looking at a couple logs and compressing them. Just wondering what are a regular maintenance you ...
7
votes
10answers
6k views

Scripting alternatives to Bash shell scripts

I have just migrated to a UNIX workstation. My memory of Bash shell scripts has faded since school and I find the syntax to be highly confusing. I am wondering what other scripting languages are ...
7
votes
6answers
18k views

Where is the sudoers file on Solaris?

Where is the sudoers file in Solaris? Is it different between Solaris versions (specifically, 9 and 10)?
7
votes
2answers
3k views

should use sudo or just su root in server management?

Which approach is better? For desktop usage, it seems that sudo is better since: I can have a more consistent history as a normal user Don't need to remember two passwords, which is especially ...
7
votes
6answers
12k views

Monitor network traffic volume over interface

Is there a way to monitor the traffic (e.g., get a live view of the utilization) over a particular network interface, say eth0? The catch here is that the set of tools on the box is fixed, and is ...
7
votes
5answers
7k views

Command line SIP dialer

Is there a simple command line SIP dialer for unix which can connect to SIP server, make a call and play some media file (wav/mp3)? In ideal I would look like this: sip-dailer +1xxxxxxxxxx ...
7
votes
6answers
4k views

Monitor the shell activity of a user on your Unix system?

Trust, but verify. Let's say I want to hire someone a sysadmin, and give them root access to my Unix system. I want to disable X windows for them, only allow shell usage (through SSH, maybe), so that ...
7
votes
5answers
331 views

Failed line of communication… rebooting for morons?

I work at a large corporation where we use many legacy systems. To note some of the systems: HP-UX 10.20, Windows 2000, VMEBus systems, systems designed 30+ years ago that do not communicate via ...
7
votes
6answers
6k views

improving rsync backup performance

What are the best techniques to improve rsync over ssh mirroring between unix boxes, assuming that one system will always have the master copy and the other system will always have a recent copy (less ...
7
votes
4answers
3k views

Reset user's password without root

Is there any way to allow non-root users to change other user's password. Specifically, is there a way to grant help desk employees the ability to do password resets. The help desk already can reset ...
7
votes
6answers
2k views

Linux/UNIX Server Setup Practices for /tmp

Based on what you all see out there what is a recommended configuration of /tmp on a server system and why. I've had discussions on these points over the years sometimes with basic disagreements. ...
7
votes
3answers
13k views

how to find files with incorrect permissions on unix?

I'm looking for a way to search a directory or directories and list all the files that have the wrong permissions for a public directory.
7
votes
1answer
7k views

How do I find circular symbolic links?

I'm working on a HP-UX system and I want to find if there are any circular symbolic links. So far I'm using the command: ls -lrt `find ./ -follow -type l` But it's only doing ls -lrt on current ...
7
votes
2answers
1k views

Why can the root user edit read-only files, but a regular user with sudo access can't?

If you try to append to a file with no write permissions (say, the /etc/sudoers file which is is owned by root and has 0440 permissions), if you're the actual root user, this works. However, if you're ...
7
votes
5answers
440 views

I have about 20 servers…how do I manage the SSH keys and permissions of each?

I have database servers, web servers, SVN servers, etc. Often times I ssh among them...or they auto-ssh. How do I manage what server gets to log into which others?
7
votes
2answers
273 views

Is there a way of exporting fstab info for device which is currently mounted?

Does there exist any tool which can tell you what the fstab line for a mount should be? Ie. it looks at something which has been mounted manually and tells you the line which you would have to add to ...
7
votes
4answers
13k views

In unix, what's the best way to reduce the size of a massive log file that is actively being written to?

On a linux server, I want to reduce the size of a log file which is several GB big. Cutting off the top half, or maybe the first million lines would work.
7
votes
3answers
7k views

Tripwire and alternatives

I'm wondering if anybody could guide me here. I have 3 dedicated linux servers and want to install tripwire in order to track changes in the key files/folders in the filesystem Initial research has ...
7
votes
2answers
1k views

Sorting large binary files

Is there Unix utility for sorting large files containing fixed length binary records? In other words, I'm looking for something like sort(1) but for binary files with fixed length records. I could ...
7
votes
3answers
15k views

Enabling apt-get on a default Amazon EC2 instance which has yum installed

I'd like to call something like: sudo yum install apt to enable me to use apt-get as well as yum for installation. However this doesn't work. I get the following back: Loaded plugins: ...
7
votes
2answers
613 views

Unix sort for partially ordered data sets

So I have an enormously large file (around 10GB) and need to sort it, just like in using 'sort' utility, but kindof more effectively. Problem is, that I don't have memory, CPU power, time, nor free ...
7
votes
4answers
26k views

How to recover free space on deleted files without restarting the referencing processes?

When big files are deleted on a server, the files might still be referenced by processes, so the file system doesn't have more free space. I tried to use lsof, but it seems it didn't list the deleted ...
7
votes
1answer
257 views

Is it possible to use perl, python, php, ruby or whatever to write init.d scripts?

I'm new to this SysOp stuff, so I'm wondering if it's possible to use other interpreted languages to write init.d scripts? The upfront diff for me is /bin vs. /usr/bin #!/bin/sh versus ...
7
votes
2answers
5k views

Mount a tar file - not possible?

It seems one cannot mount a tar file (read only), similarly as one mounts an ISO image file. At least, I have not found any implementation. It would be useful, for example to run a find command ...
7
votes
1answer
2k views

su: /bin/bash: Resource temporarily unavailable

Unable to switch user to postgres. Ulimit settings for postgres user is set with reasonable limits. We are not hitting max. No errors in /var/log/messages. Error: BETA -bash-4.2# sudo su - ...
7
votes
2answers
95 views

Setting timezone to UTC in unattended install

In FreeBSD, I'd like to set the timezone to UTC in an unattended way. If I run tzsetup, and select "yes" and "a" in the dialogs, for choosing UTC, I see that there are no /etc/localtime files present. ...
7
votes
1answer
328 views

Linux/Unix - /etc/sudoers - host definition

can anybody tell me in which case the sudo host definition is useful? I mean this part of a line in the sudoers file: bob host1 = NOPASSWD: reboot In which environment (except sudo via LDAP) do I ...
7
votes
2answers
1k views

Custom error message for sshd

Is it possible to set a custom error message for users denied to access a server? In fact, I'd like to only display this message if a user was rejected due to IP filter set in sshd_config. But one ...
7
votes
5answers
2k views

Replacement for NIS/YP

The company that I am working for is embarking on replacing the current locally developed NIS/YP structure with LDAP. We already have AD in house for the Windows stuff and would like to consider ...
7
votes
1answer
2k views

using temporary files vs pipes advantages and disadvantages

Say I have a file named jobs.csv and I would like to get the top 50k jobs done by Foo I can either do: # cat jobs.csv | sort -u | head -n 50000 > /tmp/jobs.csv # cat /tmp/jobs.csv | while read ...
7
votes
4answers
3k views

Automatically-reconnecting TCP tunnel

I have an unreliable network connection between two machines: sometimes active TCP connections get dropped for reasons beyond my control. I want to establish a reliable TCP connection between the two ...
7
votes
1answer
3k views

nodejs server hanging from time to time

I have a node server (0.6.6) running an Express application, along with Mongoose and s3, on an Ubuntu 11.04 machine. Several times per hour, the server is hanging. That means that the application is ...
7
votes
2answers
23k views

In unix/linux, what is the proc directory for? why does it exists? [closed]

In unix/linux, what is the proc directory for? why does it exists? What can I use it for (if not just for the system)?
6
votes
8answers
7k views

Linux - use “su -” but keep the current directory

When I do su - to get to root, my current directory is set to root's home. Is there anyway to keep the current directory that I was in, much like sudo -s. Or is the answer to use sudo?
6
votes
5answers
3k views

Combine multiple unix commands into one output

I need to search our mail logs for a specific e-mail address. We keep a current file named maillog as well as a week's worth of .bz2 files in the same folder. Currently, I'm running the following ...
6
votes
3answers
234 views

OS/2 grep had a great feature where it would show you n lines BEFORE the search item was found. Is there an equivalent in unix anywhere?

Solaris would be preferable, but I'll take linux or something I can compile. Does such a beast exist?
6
votes
2answers
12k views

how to run cron job every 3 months?

What would be the crontab entry look like for a job that runs on the first day of every third month?
6
votes
2answers
258 views

Why are Unix applications documented with an number in parenthesis with man?

When I try to get help on a Unix command, I get reference to say tar(1) or lsof(8). Why is there a number within parenthesis and what does it refer to exactly ?
6
votes
6answers
17k views

How do i find out which Fedora version I'm running from the cli (not uname -a)?

I want to know if the box is Fedora Core 4 or Redhat 9, or CentOS, etc... not if it has Kernel 2.6.x
6
votes
8answers
22k views

Is it possible to prevent SCP while still allowing SSH access?

Using Solaris and Linux servers and OpenSSH, is it possible to prevent users from copying files using "scp" while still allowing shell access with "ssh"? I realize that 'ssh $server "cat file" ' type ...
6
votes
6answers
787 views

Source vs Package Managers on the job

I am a bit confused, as there are two ways to install applications. One being to configure and make from source and the other from a package manager. If one were a UNIX/Linux administrator, is it ...
6
votes
3answers
7k views

What's the purpose of setgid directory?

I know how setgid works, but I don't know why it is designed, is there any example to illustrate what problems it solves?
6
votes
5answers
4k views

How to include all files from a directory in shell script (/etc/init.d/iptables in this case)

I have an /etc/init.d/iptables start|stop|restart script on different ubuntu servers (which is a normal shell script) For each new service I have to edit and insert a line to open a port. This leads ...
6
votes
5answers
1k views

Is there still a reason why binding to port < 1024 is only authorized for root on Unix systems?

On Unix systems, binding to tcp port < 1024 from a process without root privileged is denied. What was the initial reason and is it still valid ? For example http server don't need root ...
6
votes
4answers
9k views

How to add a user without knowing the encrypted form of the password?

I use the following command to create a user in a linux machine: useradd -d /home/dummy -g idiots -m -p 12345689 dummy The user is created and the home directory as well. The problem is that I ...
6
votes
4answers
5k views

After deleting a large file, how long does it take `df` to pick up the change?

I deleted a 2.3GB log file on my Ubuntu server, and df doesn't seem to be picking up the change. Is there typically a delay before df can detect that a large file has been deleted?