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

41
votes
3answers
31k views

Ubuntu shutdown fail “* Killing all remaining processes…”

I have a fresh installation of Ubuntu Server. "reboot" works, but shutdown fails on the * Killing all remaining processes... step. I am using: sudo shutdown now After the failure, indicated by [...
40
votes
7answers
38k views

Unix zip directory but excluded specific subdirectories (and everything within them)

I'm trying to zip a directory (on Unix via SSH) but I need to exclude a couple of subdirectories (and all files and directories within them). So far I have this: zip -r myarchive.zip dir1 -x dir1/...
39
votes
4answers
48k views

Find out if user name exists

How can I find out, in a shell script, whether a given user name exists on the current system? /etc/passwd and /etc/shadow are incomplete. Consider OS X's Directory Services, or Linux with Likewise ...
39
votes
3answers
30k views

Unix: How to unsplit in screen

I'm trying to learn how to use screen, in unix so that I don't have to open up several ssh connections and terminal windows just because I want to do more than one thing at the same time on a machine. ...
39
votes
3answers
21k views

Does rm -f follow symbolic links?

I have a directory like this: $ ls -l total 899166 drwxr-xr-x 12 me scicomp 324 Jan 24 13:47 data -rw-r--r-- 1 me scicomp 84188 Jan 24 13:47 lod-thin-1.000000-0.010000-0.030000.rda drwxr-...
38
votes
7answers
73k views

Which is more efficient - tar or zip compression? What is the difference between tar and zip?

I'm working in Linux environment and want to know about tar and zip commands. Which is more efficient - tar or zip? I also need to know the differences between the tar and zip commands. Can anyone ...
38
votes
7answers
35k views

How can I find the oldest file in a directory tree

I'm looking for a shell one-liner to find the oldest file in a directory tree.
37
votes
12answers
37k views

What commands can I use to reset and clear my terminal?

I have been using the command: reset to clear my terminal. Although I am pretty sure this is not what I should be doing. Reset, as the name suggests resets your entire terminal (changes lots of ...
37
votes
2answers
8k views

What does the command “sudo !!” mean?

I saw the command sudo !! in a video. What does this mean?
37
votes
4answers
69k views

How do I make sudo preserve my environment variables?

Using sudo 1.7.4p4 on Solaris 5.10 and sudo 1.6.7p5 on RHEL4 u6 I can't see how to preserve my environment variables, for instance $PYTHONPATH. I've added this line to sudoers, but it doesn't make any ...
36
votes
6answers
27k views

On Linux/Unix, does .tar.gz versus .zip matter?

Cross-platform programs are sometimes distributed as .tar.gz for the Unix version and .zip for the Windows version. This makes sense when the contents of each must be different. If, however, the ...
35
votes
14answers
18k views

What is Gnome / KDE etc?

I have been on Windows my entire life. Without getting too technical, what are these things? When I search on the net, I get some technical results. I simple do not understand what these things are! ...
34
votes
4answers
102k views

How to gzip multiple files into one gz file?

I have 100 files: cvd1.txt cvd2.txt ... cvd100.txt How to gzip 100 files into one .gz file so that after I gunzip it, I should have cvd1.txt, cvd2.txt ... cvd100.txt separately? Thanks for your ...
34
votes
8answers
21k views

Rename a group of files with one command

If I have a group of files with a .htm extention, how can I rename them all to .html? mv *.htm *.html does not work.
34
votes
6answers
2k views

A more comfortable way to edit a long $PATH?

I want to add, in ~/.bashrc, a few directories to my $PATH. My $PATH is quite long so it's a bit hard to see what directories it contains and in what order. I know I can modify my ~/.bashrc to be: ...
33
votes
4answers
10k views

Powershell equivalent to unix `which` command?

Does powershell have an equivalent to the which command found in most (if not all) unix shells? There are a number of times I'd like to know the location of something I'm running from the command ...
33
votes
2answers
15k views

Is it a bad idea to use the same private ssh key on multiple computers?

I recently bought a laptop from which I need to access the same remote hosts that I do from my desktop. It occurred to me that it might be possible to simply copy the private key file from my desktop ...
32
votes
8answers
35k views

How Unix is Mac OS X? [closed]

From my limited knowledge: The Unix OS coder assumes the user knows what they're doing etc. versus the Apple's you can only do it the way you are allowed to do it, etc. Compared to other variations ...
32
votes
3answers
23k views

How do I get the mx records for a domain from *nix command line?

What is the best way to lookup MX records for a domain from the command line?
32
votes
1answer
30k views

Is there an equivalent to /dev/null in Windows?

If I want to ignore stdout of a command, I do this on *nix: myprog > /dev/null How do I achieve the same on Windows (in cmd or a batch file)?
32
votes
5answers
4k views

Does running commands verbosely make them slower?

I've found myself using the -v flag for lots of applications less and less (especially for trivial stuff like tar and cp). However, when I did and I was, say, unzipping a large file, it would take ...
31
votes
2answers
22k views

How does one switch between windows on VIM?

I'm using both Vim and MacVim (or well, trying to). I installed the Tagbar plugin but find it impossible to switch to the actual Tagbar window to make my selection. I've been reading loads about ...
31
votes
4answers
37k views

How do you find the parent process of a zombie process?

How do you find the parent process of zombie processes? When the child process is something where the parent is not entirely obvious... Is there some way to list processes in tree format or ...
31
votes
4answers
24k views

How to copy a file without using scp inside an ssh session?

I have logged on to a system with ssh and there is no scp present on both the systems. How to copy a file without using the scp program.
30
votes
2answers
81k views

How to UNIX sort by one column only?

I know that the -k option for the Unix sort allow us to sort by a specific column and all of the following. For instance, given the input file: 2 3 2 2 1 2 2 1 1 1 Using sort -n -k 1, I get an ...
30
votes
2answers
62k views

How do I gunzip to a different destination directory?

How do I gunzip to a destination directory other than the current one? This did not work: gunzip *.gz /putthemhere/
30
votes
2answers
66k views

Allow specific user permission to read/write my folder

I have a folder /home/samantha/folder that I want to share with the user tom. He can read/write the folder. How do I do that? chown wouldn't do it because I still want to be able to be the owner of ...
29
votes
4answers
44k views

How to copy a file in unix without altering its last modified time?

If I copy some file from some place to another using cp, the timestamp on the copied file is set to the time of the copy. Is there some way to avoid this? I need to copy files without altering their ...
29
votes
2answers
20k views

How do I search for a word or a phrase in the Linux 'man' command and cycle through the found solutions?

When looking for a certain word or phrase in the man page of Linux command, one can type '/' followed by the word or phrase to search for it. What I'd like to be able to do is to search for the next ...
28
votes
9answers
25k views

How can I prepend a line number and tab to each line of a text file?

How can I append a line number and tab to the beginning of each line of a text file?
28
votes
4answers
15k views

How are PID's generated?

On *nix, PIDs are unique identifiers for running processes. How are PID's generated? Is it just an integer which gets incremented or a more complex structure such as a list? How do they get recycled? ...
28
votes
6answers
5k views

What is the general consensus on “Useless use of cat”?

When I pipe multiple unix commands such as grep, sed, tr etc. I tend to specify the input file that is being processed using cat. So something like cat file | grep ... | awk ... | sed ... . But ...
27
votes
3answers
20k views

Can I monitor a local unix domain socket like tcpdump?

I'd like to monitor responses on a unix socket without disturbing the original connections and pipe them to a script for processing. I know how to do this with tcpdump for tcp connections but I ...
27
votes
5answers
14k views

What is the difference between bash and sh?

I see two types of code being used: #!/usr/bin/sh and: #!/user/bin/bash I searched for this online and opinions vary a lot. The explanations I saw on most websites say that sh is older than bash,...
27
votes
5answers
13k views

Mac OS X: at command not working

I am going to schedule a job by using at command. Here I tried the following command: $ at now + 1 minute echo 'Test at command' <EOD> I saw the job is scheduled by using at -l. However, I ...
27
votes
1answer
4k views

Is there a way to make bash more TAB friendly?

I use bash on both my Mac and as my cygwin shell. Overall, I'm quite pleased with it. My one complaint however is that its TAB completion isn't as good as Windows Command Line TAB completion. For ...
26
votes
7answers
36k views

Find and delete all the directories named “test” in linux

I have many directories named "test" and I would like to remove them. I know how to find them and print them using: find . -name test -print Now, how to do I remove the directories? Please note ...
26
votes
3answers
107k views

How can I concatenate two files in Unix?

How can I create a new file "new.txt" that is a concatenation of "file1.txt" and "file2.txt" in Unix?
26
votes
3answers
82k views

Command: sudo su -

I understand what su - does logs you into root with the root environment (as opposed to su which logs you into root with your environment) And I understand what sudo does you are root for one ...
26
votes
7answers
32k views

ps: How can i recursively get all child process for a given pid

How can I get the entire process tree spawned by a given process displayed as a tree and only that tree i.e. no other processes? The output could e.g. look like 4378 ? Ss 0:10 SCREEN ...
26
votes
1answer
66k views

What does directory permission 'S' mean? (not lower case, but in upper case)

I downloaded Eclipse, uncompressed it, did a few other things and all sudden I notice this interesting behaviour: ^_^ ~/Downloads > sudo chmod 0000 eclipse/ ^_^ ~/Downloads > stat eclipse/ ...
26
votes
5answers
19k views

Exclude hidden files when searching with Unix/Linux find?

What options do I need to use with find to exclude hidden files?
25
votes
2answers
25k views

Counting total number of matches with grep instead of just how many lines match

Does grep offer a way to count the total number of matches it makes? The -c option only returns the number of lines that matched the regex, but in this case I have multiple matches per line.
24
votes
2answers
16k views

How do I interpret the results of the `ls -l` command?

I want to learn about the meaning of values for example first line; drwxr-xr-x 2 ataka root 4096 2008-11-04 16:58 ataka is ataka here the owner of directory ? kioutsovkm@orkide:/users/lnxsrv2/ee$ ...
24
votes
1answer
16k views

Does rsync delete files, folders at destination by default?

Files Suppose that /foo/src contains only A.c and that /foo/dest contains both A.c and B.c. And suppose I run the following command: rsync /foo/src/ /foo/dest Will rsync erase B.c? Folders Now ...
24
votes
2answers
37k views

What is a CPU tick?

Question: How is a CPU tick calculated and what does it represent? Does a single tick equate to 10 miliseconds thus if some thread reported not called for (5 * 10 ticks = 500 ticks) does this mean ...
23
votes
9answers
19k views

What's the difference between the commands “su -s” and “sudo -s”?

What is the difference between the two super user commands, su -s and sudo -s? They both give a shell with access to the superuser account.
23
votes
3answers
14k views

Safely get rid of “You have new mail in /var/mail” on a Mac?

I was messing around with sendmail in Rails a year ago and have had this message popping up in the terminal after every command ever since: You have new mail in /var/mail/Lance How do I properly ...
23
votes
13answers
8k views

Non-Windows, non-Unix-like OS's?

Since most operating systems I've heard of besides Windows seem to derive their heritage from Unix, I've been curious whether any OS's with the following characteristics exist: Not generally ...
23
votes
2answers
15k views

How to run Unix commands from within Vim?

How can I run Unix commands while I'm inside vim?