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

445
votes
7answers
285k views

How can I sort the output of 'ls' by last modified date?

How can I sort the output of ls by last modified date?
178
votes
8answers
9k views

How far will you get with an 'rm -rf /' command?

I've often wondered how far the system will actually get if you run rm -rf /. I doubt the OS would be able to erase itself (?) Bonus Question: After the command has been executed, will rm have ...
175
votes
12answers
28k views

How can I change to the previous directory instead of going up?

I currently spend a lot of my working hours moving back and forth between two paths which are very far down the tree and divert from each other at root. It strikes me that my life would be a lot ...
170
votes
18answers
16k views

What is the advantage of using 'tar' today?

I know that tar was made for tape archives back in the day, but today we have archive file formats that both aggregate files and perform compression within the same logical file format. Questions: ...
154
votes
8answers
9k views

What do the parentheses and number after a Unix command or C function mean?

I keep seeing parentheses and a number after a command in Unix or Linux or C function. For example: man(8), ftok(2), mount(8), etc. What do these mean? I see them in man too.
133
votes
8answers
120k views

What is the “You have new mail” message in Linux/UNIX?

Sometimes, when I log into a box and 'su' to root, I get a cute little message saying I have mail (thank GOD it's not AOL). Where is this mail? What does it contain? Who/What sent it? How important ...
111
votes
17answers
55k views

How to execute a command whenever a file changes?

I want a quick and simple way to execute a command whenever a file changes. I want something very simple, something I will leave running on a terminal and close it whenever I'm finished working with ...
103
votes
18answers
8k views

What's the quickest way to count the number of each character in a file?

I want to count the A's T's C's G's N's and "-" characters in a file, or every letter if needed, is there a quick Unix command to do this?
97
votes
6answers
139k views

How to get the summarized sizes of folders and their subfolders?

Let's say I want to get the size of each folder of a linux file system. When I use ls -la I don't really get the summarized size of the folders. If I use df I get the size of each mounted file system ...
97
votes
10answers
56k views

How do I set up SSH so I don't have to type my password?

How do I set up SSH so I don't have to type my password when connecting to a host?
90
votes
6answers
66k views

What's different between Ctrl+Z and Ctrl+C in Unix command line?

I'm using Mac OS X Terminal. And I use Ctrl+Z or Ctrl+C to stop some programs. But I realized that I don't know what they're exactly doing. What are they and what's the difference between them? ...
81
votes
6answers
60k views

How to copy with cp to include hidden files and hidden directories and their contents?

How can I make cp -r copy absolutely all of the files and directories in a directory Requirements: Include hidden files and hidden directories. Be one single command with an flag to include the ...
77
votes
8answers
36k views

How can I search the bash history and rerun a command?

Can I search history in bash and run the result?
72
votes
3answers
19k views

less command with multiple files: How to navigate to next/previous

I just found out I can use less with multiple files. less status line tells me (END) - Next: file2.txt But how do I navigate previous/next from less?
67
votes
6answers
5k views

Choosing between .bashrc, .profile, .bash_profile, etc [duplicate]

This is embarrassing, but after many years of using POSIX systems full time, I still have a hard time figuring out if a shell customization should go in .bashrc, .profile, or somewhere else. Not to ...
62
votes
12answers
5k views

What command do I need to use to remove a file called `-rf`?

I did something crazy at some point that created a file called -rf on my filesystem. Now I can't figure out how to delete it... I've tried: rm "-rf" rm \-rf These just exit immediately, arrgh! ...
57
votes
13answers
6k views

Is Unix not a PC operating system? [closed]

I am doing my bachelor's degree at a university. In a written assignment, the professor posted the task: "Name three PC operating systems". Well, I went on an included a variety of OSes (Linux, ...
56
votes
8answers
15k views

Why is “Everything is a file” unique to the Unix operating systems?

I often hear people say "Unix's unique philosophy is that it treats everything as a file" or "In Unix, everything is a file". But I've never heard anyone explain why it is unique to Unix. So, why is ...
50
votes
2answers
27k views

Why does Windows use backslashes for paths and Unix forward slashes?

It annoys me having used Unix in college and now working on the Windows side. What's the history behind this decision? Anyone know why it worked out this way?
49
votes
3answers
66k views

What is the “wheel” user in OS X?

I recently reinstalled iTunes and I noticed something peculiar. The "original" version of iTunes has a user in the permissions known as "wheel" that is set to "Read Only". I dragged this version of ...
48
votes
6answers
138k views

ls-command: how to display the file size in megabytes?

In Unix (Tru64), how do I make the ls command show the file size in megabytes? Currently I am able to show it in bytes using the following: ls -la
48
votes
3answers
104k views

How can I make chown work recursively?

I've got a directory called pdfs that contains a bunch of sub- and sub-sub-directories. I want to change ownership on all PDF files in all of the subfolders. I just tried this: chown -R ...
46
votes
2answers
50k views

What is the Windows equivalent of the Unix command cat?

I want to do exactly what unix "cat" does, but on my PC. Is there a simple equivalent command for the Windows command line? Specifically I want to create a file from all the files of a given type in ...
46
votes
3answers
14k views

less is more? Is more less? I'm so confused

When I first heard their names, I got really confused when I tried to guess what these tools might do, I thought I'd misheard something. What's the difference between more and less, i.e. why ...
45
votes
4answers
48k views

How can I find files that are bigger/smaller than x bytes?

In a terminal, how can I find files that are bigger or smaller than x bytes? I suppose I can do something like find . -exec ls -l {} \; and then pipe the result to awk to filter by file size. But ...
45
votes
3answers
74k views

How to make new file permission inherit from the parent directory?

I have a directory called data. Then I am running a script under the user id 'robot'. robot writes to the data directory and update files inside. The idea is data is open for both me and robot to ...
44
votes
12answers
55k views

Unix/Linux find and sort by date modified

How can I do a simple find which would order the results by most recently modified? Here is the current find I am using (I am doing a shell escape in PHP, so that is the reasoning for the variables): ...
44
votes
4answers
145k views

What is the .bashrc file?

Unix shells when starting read the .bashrc file and execute commands written in it. What is this file and what does it execute?
43
votes
3answers
29k views

What does load average mean in unix/linux?

If I run uptime, I get something like this: 10:50:30 up 366 days, 23:27, 1 user, load average: 1.27, 2.06, 1.54 What do those numbers on the end mean? The man page tells me it's "the load ...
42
votes
6answers
24k views

Is there a way to see any tar progress per file?

I have a couple of big files that I would like to compress. I can do this with for example tar cvfj big-files.tar.bz2 folder-with-big-files The problem is that I can't see any progress, so I don't ...
41
votes
11answers
7k views

What is the relationship between Unix, Linux, Ubuntu and Debian?

What is the relationship between Unix, Linux, Ubuntu, and Debian? I suspect they are all Operating Systems that are based upon one another - similar to how Windows is based on DOS. Is my suspicion ...
38
votes
10answers
25k views

Unix: ls, how to sort first directories then files etc

I would like to use ls command to first show direcotries and then files. I tried ls -la | sort -k 1 But I got a wrong order.
37
votes
3answers
53k views

If I know the PID number of a process, how can I get its name?

If I have the PID number for a process (on a UNIX machine), how can I find out the name of its associated process? What do I have to do?
37
votes
2answers
11k views

How to start vim without executing /etc/vimrc?

On my Linux server at work, the admins did not install cscope, and I installed it from source in my home directory and added it to the $PATH. The trouble is, the /etc/vimrc has a reference to ...
37
votes
3answers
23k 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 ...
37
votes
4answers
10k views

What is the origin of the UNIX $ (dollar) prompt?

The UNIX prompt uses a $ symbol to indicate that your input is expected. I was wondering why this symbol was chosen -- if there is a reason. Dollar just seems a little unexpected. A > would have been ...
34
votes
2answers
5k views

'less' command clearing screen upon exit - how to switch it off?

How to force the less program to not clear the screen upon exit? I'd like it to behave like git log command: it leaves the recently seen page on screen upon exiting it does not exit the less even ...
33
votes
3answers
6k views

What does the 'rc' in `.bashrc`, etc. mean?

Well, this is embarrassing. I feel like I just realised I don't know a loyal colleague's name after working with them for 10 years. "Hey, er... *cough!*, thanks for that great job you did on setting ...
33
votes
4answers
11k views

Bash: Spaces in alias name

I am trying to create an aliases in bash. What I want to do is map ls -la to ls -la | more In my .bashrc file this is what I attempted: alias 'ls -la'='ls -la | more' However it does not work ...
31
votes
15answers
14k 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! ...
31
votes
2answers
8k views

How do I reload .inputrc?

Background I have heard that the readline module is reading ~/.inputrc and that is how it changes the behaviour of keystrokes under programs such as bash. Question How can I reload this after ...
30
votes
2answers
5k views

What does the command “sudo !!” mean?

I saw the command sudo !! in a video. What does this mean?
29
votes
8answers
13k 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.
29
votes
3answers
23k 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 ...
29
votes
2answers
13k 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 ...
28
votes
10answers
19k views

Bash: Reset and Clear Commands

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 ...
28
votes
5answers
2k 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 ...
27
votes
9answers
24k 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 ...
27
votes
5answers
11k 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 ...
27
votes
3answers
47k 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 ...