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

382
votes
7answers
242k 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?
171
votes
8answers
8k 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 ...
169
votes
12answers
25k 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 ...
164
votes
18answers
14k 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: ...
145
votes
8answers
8k 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.
113
votes
6answers
100k 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 ...
102
votes
18answers
7k 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?
93
votes
16answers
45k 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 ...
93
votes
10answers
50k 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?
82
votes
6answers
55k 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? ...
79
votes
6answers
120k 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 ...
66
votes
5answers
30k views

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

Can I search history in bash and run the result?
66
votes
6answers
3k 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 ...
64
votes
5answers
46k 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 ...
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
3answers
15k 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?
56
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 ...
46
votes
2answers
23k 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?
42
votes
3answers
57k 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 ...
41
votes
3answers
67k 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 ...
40
votes
6answers
116k views

ls-command: how to print file size in megabytes?

On Unix (Tru64), how to show file size in megabytes? This procudes sizes in bytes ls -la
39
votes
12answers
47k 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): ...
39
votes
3answers
12k 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 ...
39
votes
3answers
25k 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 ...
38
votes
2answers
39k 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 ...
38
votes
3answers
74k 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 ...
38
votes
6answers
20k 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 ...
37
votes
4answers
40k 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 ...
36
votes
4answers
123k views

What is the .bashrc file?

Unix shells when starting read the .bashrc file and execute commands contained in them. What is this file and what do they execute?
36
votes
4answers
9k 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
9answers
22k 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.
33
votes
2answers
9k 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 ...
32
votes
3answers
21k 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 ...
32
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 ...
31
votes
4answers
10k 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 ...
30
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! ...
29
votes
3answers
29k 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?
29
votes
2answers
5k views

What does the command “sudo !!” mean?

I saw the command sudo !! in a video. What does this mean?
29
votes
2answers
12k 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
3answers
5k 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 ...
27
votes
5answers
9k 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 ...
26
votes
8answers
11k 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.
26
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 ...
26
votes
2answers
7k views

How do I reload .inputrc?

Background (probably wrong) 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 ...
25
votes
3answers
19k 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 ...
24
votes
9answers
21k 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 ...
24
votes
2answers
12k 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. ...
23
votes
10answers
16k 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 ...
23
votes
1answer
3k 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 ...