Skip to main content

Questions tagged [unix]

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

Filter by
Sorted by
Tagged with
425 votes
3 answers
357k views

How do I change my private key passphrase?

I have an existing public/private key pair. The private key is password protected, and the encryption may be either RSA or DSA. These keys are the kind you generate with ssh-keygen and generally store ...
kch's user avatar
  • 4,722
377 votes
20 answers
614k views

How do I get the current Unix time in milliseconds in Bash?

How do I get the current Unix time in milliseconds (i.e number of milliseconds since Unix epoch January 1 1970)?
Richard's user avatar
  • 4,052
340 votes
18 answers
447k 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 ...
Amandasaurus's user avatar
  • 32.5k
284 votes
13 answers
101k 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 ...
ojrac's user avatar
  • 2,943
245 votes
13 answers
155k 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 ...
Gant's user avatar
  • 2,595
238 votes
3 answers
256k 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?
Some Linux Nerd's user avatar
233 votes
19 answers
301k 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 ...
MikeN's user avatar
  • 8,502
231 votes
8 answers
276k 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 ...
John Lawrence Aspden's user avatar
217 votes
11 answers
344k views

How to read backward from the end of file in less or more?

I've found one way so far: less +G filename, but it scrolls up line-by-line only with ↑. What's a more powerful less usage which provides scrolling by page, backward pattern search, and so on?
yetanothercoder's user avatar
191 votes
6 answers
511k 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?
John Topley's user avatar
  • 2,215
176 votes
9 answers
223k 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 ...
mike's user avatar
  • 4,033
167 votes
9 answers
562k views

How to remove empty/blank lines from a file in Unix (including spaces)?

How do I remove empty/blank (including spaces only) lines in a file in Unix/Linux using the command line? contents of file.txt Line:Text 1:<blank> 2:AAA 3:<blank> 4:BBB 5:<blank> 6:...
Michael Ellick Ang's user avatar
165 votes
8 answers
132k 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 ...
egorgry's user avatar
  • 2,911
147 votes
7 answers
59k 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 ...
Luke's user avatar
  • 3,856
134 votes
3 answers
150k views

How can I rename a Unix user?

I have a user named old_username and I want him to be named new_username, but I don't want to change his numeric user ID. How can I accomplish this?
Szymon Jeż's user avatar
  • 3,587
132 votes
8 answers
324k 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 ...
Rehan's user avatar
  • 1,423
124 votes
8 answers
284k views

How to get pid of just started process

I want to start process (eg. myCommand) and get its pid (to allow to kill it later). I tried ps and filter by name, but I can not distinguish process by names myCommand ps ux | awk '/<myCommand&...
rafalmag's user avatar
  • 1,351
103 votes
11 answers
255k views

How to disable everything in crontab -l?

I just want to pause everything. Don't execute anything listed on crontab -l.
Alex's user avatar
  • 8,641
102 votes
8 answers
55k 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 ...
wrangler's user avatar
  • 3,170
93 votes
7 answers
116k 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 ?
Dean Smith's user avatar
  • 1,290
93 votes
5 answers
195k views

Getting the last match in a file using grep

What's the best way of getting only the final match of a regular expression in a file using grep? Also, is it possible to begin grepping from the end of the file instead of the beginning and stop ...
Acorn's user avatar
  • 1,097
83 votes
10 answers
671k views

How to check what port mysql is running on

On my windows dev box mysql is running on port 3306 How can I check what port it is running on the unix server that I have to upload the app to.
Ankur's user avatar
  • 2,379
71 votes
8 answers
85k 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 ...
James Dean's user avatar
71 votes
4 answers
68k views

What is the "slash" after the IP? [duplicate]

In Amazon EC2, where I set "security groups", It says: Source: 0.0.0.0/0 And then it gives an example of: 192.168.2.0/24 What is "/24"? I know what port and IP is.
Alex's user avatar
  • 8,641
70 votes
3 answers
57k views

Better logging for cronjobs? Send cron output to syslog?

I am looking for a better way to log cronjobs. Most cronjobs tend to spam email or the console, get ignored, or create yet another logfile. In this case, I have a Nagios NSCA script which sends data ...
Stefan Lasiewski's user avatar
69 votes
9 answers
133k views

How do I determine the block size of an ext3 partition on Linux?

How do I determine the block size of an ext3 partition on Linux?
mike's user avatar
  • 4,033
69 votes
1 answer
213k views

Bash: Difference between > and >> operator? [closed]

I don't know much about bash. My instructor asked me to make a cat script and to observe the output and then tell what is the operator > and what is the difference between the operators > & ...
jumbo18's user avatar
  • 707
67 votes
4 answers
36k 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 ...
nos's user avatar
  • 2,488
66 votes
1 answer
72k views

Capturing STDERR and STDOUT to file using tee

I'm unclear what the best order is to capture both STDERR and STDOUT to the same file using tee. I know that if I want to pipe to a file I have to map the filehandle after the redirect, i.e. find . &...
PP.'s user avatar
  • 3,456
64 votes
5 answers
42k views

A better unix find with parallel processing?

The unix find(1) utility is very useful allowing me to perform an action on many files that match certain specifications, e.g. find /dump -type f -name '*.xml' -exec java -jar ProcessFile.jar {} \; ...
PP.'s user avatar
  • 3,456
64 votes
9 answers
248k views

How to change owner of mount point

We have moved mysql data directory to another disk, so now /var/lib/mysql is just a mount point to another partition. We set the owner of the /var/lib/mysql directory to mysql.mysql. But everytime we ...
Arie K's user avatar
  • 1,633
61 votes
10 answers
104k views

How can I find the biggest directories in Unix / Ubuntu?

Is there a way in Unix to see the biggest directories on disk? I need to know why I'm almost out of space on the server,= and I don't know where most of the space is used.
aneuryzm's user avatar
  • 1,754
61 votes
6 answers
87k views

How can I run mongod in the background on unix (mac osx)?

I would like to run mongod in the background as an always present sort of thing. What would be the best way to do this? Kind of like the way I can run MySQL on startup and it's just always there ...
rmontgomery429's user avatar
60 votes
18 answers
30k 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 ...
Amandasaurus's user avatar
  • 32.5k
60 votes
1 answer
44k views

rsync - Exclude files that are over a certain size?

I am doing a backup of my desktop to a remote machine. I'm basically doing rsync -a ~ example.com:backup/ However there are loads of large files, e.g. wikipedia dumps etc. Most of the files I care a ...
Amandasaurus's user avatar
  • 32.5k
59 votes
5 answers
101k views

Create Unix Named Socket from the Command Line

Is there a command similar to mkfifo but for domain sockets?
benmmurphy's user avatar
59 votes
5 answers
32k 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?
Steven T. Snyder's user avatar
59 votes
3 answers
10k 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 other?...
Aaron K's user avatar
  • 1,515
58 votes
6 answers
65k views

How do I print contents of at jobs?

I have a Debian box with some jobs scheduled using at. I know I can list the jobs with their times using atq, but is there any way to print out their contents, apart from peeking into /var/spool/cron/...
che's user avatar
  • 729
57 votes
10 answers
116k views

How to Chown a directory recursively including hidden files or directories

Seems like chown with the recursive flag will not work on hidden directories or files. Is there any simple workaround for that?
toby's user avatar
  • 671
56 votes
6 answers
41k 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 ...
Amandasaurus's user avatar
  • 32.5k
56 votes
4 answers
116k 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?
haim evgi's user avatar
  • 753
54 votes
7 answers
123k 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 ...
Deleted's user avatar
  • 1,832
54 votes
2 answers
10k 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 ...
Brian Lyttle's user avatar
  • 1,747
54 votes
3 answers
32k 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 ...
Ludo's user avatar
  • 1,109
53 votes
3 answers
96k views

.nfsXXXX files appearing, what are those?

I have an application running (on RHEL5) that streams data onto an NFS share. Recently, I saw a lot of .nfsXXXX... (xxx being a hexadecimal number) appearing in its working directory, where the ...
nos's user avatar
  • 2,488
52 votes
6 answers
49k views

How to make a global ~/.vimrc?

Right now, I make everyone do ~/.vimrc and put their settings there. How can I make a global, default .vimrc for new users?
Alex's user avatar
  • 8,641
49 votes
10 answers
19k 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 ...
Simon Willison's user avatar
48 votes
4 answers
142k views

apt-get update/upgrade list without changing anything

I would like to view what packages are available for update/upgrade without actually changing any files becuase there are some packages I wouldn't like to update. Would it then be possible to apt-get ...
John Magnolia's user avatar
48 votes
7 answers
85k views

How to find other end of unix socket connection?

I have a process (dbus-daemon) which has many open connection over UNIX sockets. One of these connections is fd #36: =$ ps uw -p 23284 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME ...
user avatar

1
2 3 4 5
40