A shell is software that lets users interact with the operating system, usually by typing at a command-line.

learn more… | top users | synonyms

21
votes
6answers
45k views

why run a Linux shell command with &?

I am using Red Hat Linux Enterprise version 5. I've noticed people sometimes running commands with a couple of & options. For example, in the below command, there are two & signs. What is the ...
21
votes
4answers
8k views

How do I change a users default shell in OSX?

What is the correct OSX way of changing a users default shell? When I googled for it I found several references to an application called NetInfo Manager but I couldn't find it on my system. There were ...
21
votes
4answers
14k views

Looping Through Subdirectories and Running a Command in Each

I have a set of repositories sorted into directories based on their VCS (Git, Mercurial, SVN). With Subversion I was able to run svn update * in the parent directory and it would loop through each ...
21
votes
5answers
22k views

How can I do a recursive find and replace from the command line?

Using a shell like bash or zshell, how can I do a recursive 'find and replace'? In other words, I want to replace every occurrence of 'foo' with 'bar' in all files in this directory and its ...
21
votes
7answers
84k views

How do I run the Windows 7 Explorer shell with Administrator Privileges by default?

The Windows 7 shell (Explorer) can be made to run with Administrator privileges by this manual process: Kill Explorer shell by holding down Shift+Ctrl, right-clicking the Shut down button in the ...
20
votes
4answers
27k views

Delete matching files in all subdirectories

How can I remove all .swp files in all of my subdirectories under Linux?
20
votes
3answers
4k views

How do you run the previous command in emacs shell?

I am in terminal mode on Ubuntu, and I'm running emacs with 2 buffers open, one is a ruby file, and the other is a shell (opened by typing M-x shell ), and when I switch to the shell buffer, I want to ...
20
votes
1answer
4k views

ZSH Completion colors and OS X

Consider this minimal .zshrc : export CLICOLOR=1; export LSCOLORS=exfxcxdxbxegedabagacad; # It is the default value on OSX, so this line can be omitted autoload -Uz compinit compinit zstyle ...
19
votes
9answers
73k views

What is the shell command to display contents of a file?

Like that of .txt or .html
19
votes
6answers
31k views

Remove file without asking

How can I remove file without asking user if he agrees to delete file? I am writing shell script and use rm function, but it asks "remove regular file?" and I really don't need this. Thank you.
19
votes
3answers
8k views

Random password generator: many, in columns, on command line, in Linux

A while back, I came across a random password generator for the command line that displayed a grid of "memorable" passwords. Output was something like this: adam@host:~$ CantRememberThisCommand ...
19
votes
3answers
8k views

Screen a running process

Sometimes I forget to run a program under a screen session and can't stop it in the middle, and I know it's going to take long. Is there a way to screen an already running process without restarting ...
18
votes
3answers
12k views

What is the difference between CMD and Command prompt in windows?

Until now, I never thought (and never observed) that cmd and command are two different things. Well, are they? Take a look at this pic: Actually, I usually open cmd from the Run dialog whenever I ...
18
votes
5answers
47k views

How can I edit the $PATH on linux?

I am using ubuntu 9.04 I need to add some folder to my $PATH. I know how to read the path: echo $PATH I want to be able to edit it and add 2 other paths. Thanks
18
votes
2answers
7k views

scp between two remote hosts from my local

I have two remote hostes. host1-> 10.3.0.1 host2-> 10.3.0.2 Both are installed with ssh and scp. In my scanario, ssh and scp listen to port 22 in host1 and in host2 it is port 6969. Now, using my ...
17
votes
2answers
12k views

zsh with Cygwin

How can I configure zsh to be the default shell under Cygwin?
17
votes
3answers
18k views

How to cd to a directory that contains a space in its name?

I have a directory called "Reader 0.5" in my Desktop on Mac Os X. When to access the directory in terminal, I am using below code: cd /Users/niho/Desktop/Reader 0.5 but it throws: No such file or ...
17
votes
4answers
7k views

Bash/ZSH: Undoing 'disown'

Is there a way to 'reattach' a process to the shells job table after it it has been 'disowned'? Edit: $SEARCHENGINE totally fails me. Doesn't look too good.
16
votes
9answers
43k views

Opening Explorer shell with admin privileges on XP (with IE7 installed)

I used to demote my user account so that it had no admin priveleges and used a 'sudo-like' trick where you create a shortcut to IE6 and enabled the 'Run with different credentials' option to open a ...
16
votes
3answers
8k views

How to remove shell integration of Notepad++?

I need to remove the annoying shell integration of Notepad++. How do I do that, please?
16
votes
3answers
15k views

How do I fork a process that doesn't die when shell exits?

If I run emacs from the shell: $ emacs foo & and then kill that shell, emacs dies. How can I run a command so that it will not die when the shell dies? I found references to nohup, but that ...
16
votes
3answers
899 views

Prevent currently running linux task to be killed after logout from SSH

I have a computational task running for a few days on a linux server via SSH connection. It is not on the background, so the SSH connection is under hold of the task. I want to restart the local ...
16
votes
4answers
13k views

Clear terminal using keyboard shortcut

I was curious if there is a way to clear the terminal buffer/output through some keyboard shortcut. I am using Ubuntu. I am aware that Ctrl + L clears the terminal, but you can still scroll back to ...
16
votes
6answers
314 views

Want to try out Linux, what do?

I've been learning ruby on rails for a while. At first I resisted using the console, but after a while I can say that I LOVE it. If Linux is anything like that, I think it's going to be legit. I ...
16
votes
3answers
6k views

Use GNU screen as login “shell”

What's the best way to have screen automatically run when you open a new shell, whether by login, xterm, or anything else? I see the most common recommendation is to put exec screen in your regular ...
15
votes
10answers
16k views

Mac OS X - Could not start Terminal.app - shell has illegal value

I can not run the Terminal.app after rolling back my system from time machine. Mac OS X Version 10.6.2 It displays the following error. "Your are not authorized to run this application" "The ...
15
votes
5answers
15k views

Console like Gnome Terminal for Windows

I'm looking for console like the Gnome Terminal for Windows to replace cmd.exe. I'd like to have tabs and easy copy&paste. Do you know a tool like that?
15
votes
5answers
12k 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.
15
votes
3answers
2k views

Multiple standard input? How?

From this commandlinefu post: $ diff <(wget -q -O - URL1) <(wget -q -O - URL2) Seems like multiple standard inputs but---if I remember my Linux Porgramming course correctly---this can't be ...
14
votes
7answers
899 views

Is there a way to go to any directory from any other directory directly?

Is there a way to go to any directory from any other directory directly? For example, lets say that I'm at root and I wanted to go directly to currentProject without doing: cd ...
14
votes
2answers
19k views

how to bring a background job to foreground

in Linux/shell, how can I bring background jobs to foreground and vice versa?
14
votes
9answers
10k views

Command aliases in Command Prompt?

How can I make command aliases in Windows' Command Prompt like I would with bash? I found out about doskey in a forum thread, so I can do something like: doskey ls=dir /b ...and now the command ls ...
14
votes
5answers
365 views
14
votes
4answers
3k views

A command before every bash command

Does anyone know a mean of putting a 'time' command before every command in a bash session?
14
votes
2answers
4k views

Re-enter interactive mode after Ctrl-z

In interactive mode (in Octave, gnuplot, R, etc.) I occasionally press Control + z by mistake. This pauses the program and kicks me back to the terminal. Is it possible to re-enter the original ...
14
votes
1answer
16k views

When creating a symbolic link, how do I troubleshoot 'too many levels of symbolic links'?

I'm trying to create a symbolic link on Ubuntu 10.04 it says: me@laptop:~/PHPUnit$ ls assertions.php LICENSE PHPUnit README.markdown build.xml package.xml phpunit.bat ...
14
votes
2answers
5k views

Putty SSH: CTRL+Cursor keys don't work skip to previous/next word

When I am connected to my local Ubuntu dev server with putty (from my Windows 7 box) via SSH, the following key combinations don't work to move the cursor forward and backward on word boundaries: ...
14
votes
5answers
8k views

Linux Shell: Copy output into clipboard w/o using the Mouse?

Is it possible to copy the output into the clipboard without using the mouse? For example, I would like to do something like this: $ pwd >> clipboard
13
votes
8answers
33k views

How to resume CUPS printer from command line?

I have printer in CUPS that due to driver problems (HP 1010) from time to time goes into pause. I would like to write a shell script that will execute once per hour to resume a printer in CUPS. But ...
13
votes
6answers
19k views

Will rm -rf * remove all files/folders in the current directory?

Will rm -rf * remove all files/folders in the current directory ? I want to make sure the wildcard * won't move up in upper directories and erase all my filesystem. :D I remember doing chmod 777 .* ...
13
votes
4answers
3k views

Equivalent/Alternatives for Alt+Dot in Mac

One thing i miss from the Linux shell is the Alt+Dot shortcut. What it does is insert the last argument of the previous command. It appears to be a trivial technique, but it's really useful. i.e. if ...
13
votes
6answers
6k views

How to retrieve the absolute path of an arbitrary file from the OS X

I'm looking for a simple command that can be used within Bash to find the absolute and canonicalized path to a file on an OS X (similar to `readlink -f' under Linux). The following sample bash ...
13
votes
5answers
8k views

How can I change all files belonging to one user to another user?

I'm looking for a Linux command that can change ownership of all files belonging to a given user, preferably in a targeted directory, to another specified user. My dream command would look something ...
13
votes
2answers
3k views

How to use a pipe to edit a file with vi

Lets say I have a file called file.txt. In it is a name of a file that I want to edit with vi. I want to do something like this so that I can edit the file: cat file.txt | vi However, that doesn't ...
13
votes
1answer
2k views

chain Fish commands via `&&` or `||`

In Bash/ZSH and other shells, I am used to using && and ||. Is there any equivalent in Fish?
13
votes
3answers
7k views

Check number of pending security updates in Ubuntu

Let me start by saying I have been forbidden to enable automatic updates on our Ubuntu servers, for both security and regular packages. When I log into any of my four Ubuntu servers, the welcome ...
13
votes
1answer
7k views

Setting environment variable for just one command in Windows cmd.exe

In Bash, I can do EDITOR=vim command and command will be run with EDITOR set to vim, but this won't affect the value of EDITOR in the shell itself. Is it possible to do this in cmd.exe?
12
votes
5answers
2k views

Which directory does path `//` represent in Linux?

When I want to go back to upper level directory in Linux by typing cd .., I typo-ed cd //. To my great surprise, no errors are reported. What's more the prompt becomes username@hostname://$. ls ...
12
votes
7answers
21k views

Make ls sort by file type (then name)

By default the ls command sorts just by filename, but I want directories to appear before other file types. I might even want files to be sorted by extension, like the way Windows explorer sorts by ...
12
votes
6answers
8k views

Full command text with unix ps

When we enter: ps -f ... the CMD column text doesn't show the full command. Any way to prevent this truncating? Seems like it's showing the first 80 characters. We are running a fairly ...