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

learn more… | top users | synonyms

10
votes
3answers
7k views

What's the difference between /etc/bash.bashrc and ~/.bashrc? Which one should I use?

When should I use each of the two .bashrc files to set my aliases, prompt, etc?
10
votes
4answers
10k views

How to diff directories for different files, but not line-by-line

I want to see, recursively, files that are different in two directories. Diff can do this, but it shows me the line-by-line differences, which I don't want. Is there a tool that does this, or a way to ...
10
votes
2answers
3k 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 ...
10
votes
4answers
5k views

Better way to do “echo $x | sed …” and “echo $x | grep …”

I often find this in scripts (and, I have to admit, write it myself): a=`echo $x | sed "s/foo/bar/"` or if echo $x | grep foo then ... fi Consider "foo" to include some regex stuff. I feel ...
10
votes
3answers
10k 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 ...
10
votes
7answers
3k views

Growl Notifications for Shell Task Completion

(OSX Specific) I, like many others besides myself often find myself kicking off a process in the shell that takes a minute or two to complete (a large svn commit for example). During that time, I ...
10
votes
3answers
5k 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?
10
votes
5answers
12k views

Is there a way to escape single-quotes in the shell?

E. g. I want to say perl -e 'print '"'"'Hello, world!'"'"', "\n";' Is there a less awkward way to do it, e. g. escaping single-quotes? Yes, I know that I can write perl -e 'print q[Hello, ...
10
votes
2answers
3k views

How do I host a mintty shell inside of Console2?

I like to use Console2 for my Windows shell work, where I usually make it open a cygwin bash prompt. I'd like to try out MinTTY (2), and want to host it within Console2 as well. If this is possible, ...
10
votes
2answers
242 views

How to move folder in unix using mv, only when target is on the same drive

I need to move a folder using unix mv command, but only if the target is in the same drive or the same filesystem. What would be the best approach?
10
votes
1answer
484 views

Why do we have login, non-login, interactive, and non-interactive bash shells?

So the bash man pages explain what login and interactive shells are: A login shell is one whose first character of argument zero is a -, or one started with the --login option. An ...
10
votes
3answers
2k views

How can I launch a file properties dialog from the command line?

It's simple programmatically with ShellExecute to specify the properties verb when instructing Windows to open a file, but can this be done from the command line or run box? Ideally I'd like to do ...
9
votes
2answers
650 views

Shrinking file size under Linux

I want to shrink a file's size by brute-force, that is, I don't care about the rest, I just want to cut the file, say by half, and discard the rest. The first thing that comes to mind is Perl's ...
9
votes
8answers
2k views

Mass renaming, *nix version

I was looking for a way to rename a huge number of similarly-named files, much like this one (a Windows-related question) except that I'm using *nix (Ubuntu and FreeBSD, separately). Just to sum up, ...
9
votes
2answers
5k views

http get from the shell in Mac OS X

I'd like to download a link like: http://example.org/file.mp3 Now, I'm enough of a shell junkie to know what SCP does, but that's about where my geek-dom ends. So is there a shell program that lets ...
9
votes
3answers
6k views

Bash shell: list all files of type .png or .PNG?

In a bash script, how can I say 'for all files of type .png or .PNG'? I'm trying : for i in (`ls *.PNG` && `ls *.png`) but getting a syntax error.
9
votes
4answers
8k views

Linux command to return number of bits (32 or 64)?

What is a Linux command that I can run to programmatically return either 32 or 64 to indicate whether the processor is a 32 bit or 64 bit processor?
9
votes
4answers
7k views

Why is the size of a directory always 4096 bytes in unix?

I am sure a directory file has much less information than 4096 bytes. I know the sector size is 4096 bytes. But normal files smaller than that do exist. Why does Unix reserve 4096 bytes for each ...
9
votes
3answers
620 views

Figure out what non-symlink path would be?

On Linux, if I've cd'd around and am now in a directory, is there a way to figure out what the real path to that directory is if I had not used a symbolic link to get there? Consider: $ pwd ...
9
votes
2answers
2k views

How to set terminal size in Android adb shell?

When I connect to Android using "adb shell" and run certain commands such as "vim" or "mc", they are restricted to a "window" of 25x80 characters. Since I'm connecting from a desktop computer where ...
9
votes
4answers
6k views

Terminal Vs. Shell [duplicate]

Possible Duplicate: What are the differences between shell , console & terminal? This probably sounds like a stupid question but I'm having a lot of trouble clearly differentiating ...
9
votes
3answers
2k views

Why does less tail mode stop working?

Using the less command on linux in tail mode (F command or less -f) consistently stops working on certain machines and/or certain files. New changes simply stop showing up. I know I've fixed this ...
9
votes
1answer
2k views

How do I make OS X set the terminal title back to the original title when coming back from ssh?

Starting on OS X, I ssh into foo (a Linux box). My terminal title changes to foo. I then ssh into bar (another Linux box). My terminal title changes to bar. I log out of bar. My terminal title ...
9
votes
3answers
4k views

How can I do Ctrl-Z and bg in one keypress to make process continue in background?

So I realized I follow this pattern of suspending the task and then letting it to continue too often with the Ctrl-Z bg sequence, I was wondering is there any way to compress that to single keypress? ...
9
votes
1answer
3k views

PowerShell vs. the Unix Shell

I've heard some things about the features of the PowerShell. Some of it seems like typical features of Unix shells. So it seems Powershell includes piping and the commandlets, similar to shell ...
9
votes
3answers
10k views

TortoiseSVN overlay icons do not appear when installed by a different user account?

I've installed TortoiseSVN on my work Windows XP machine as the administrator. When I login in as a standard user my working copies do not display the overlay icons in Windows Explorer. I found this ...
9
votes
3answers
8k views

Stop Windows 7 Explorer from automatically expanding folders

Windows 7 Explorer can be opened in any folder from the command line. But, it automatically expands (on the left nav panel) the Favorites, Desktop, and [Username] folders. This makes it hard to see ...
8
votes
6answers
2k views

What's the difference between the terms “Shell” and “Bash”?

What is the the difference between "Shell" and "Bash" and what do these terms mean? As far as I know, there is no difference. But I've seen many books about "Shell" and others about "Bash"! So in ...
8
votes
5answers
1k views

Finding the definition of a bash function

I work in an environment that has a lot of legacy shell script magic lying around. One thing used heavy from the command line are bash functions that get sourced from some file included from some ...
8
votes
11answers
8k views

how to `tail` the latest file in a directory

In shell, how can I tail the latest file created in a directory?
8
votes
9answers
6k views

How do I copy file named starting with a dot?

I am trying to copy all files under directory A to directory B. All files under directory A are starting with dot, for example: A/.a A/.b A/.c which I found if I use: cp A/* B, always get error: ...
8
votes
9answers
1k views

Linux & Shell - Is Shell a must?

A total newbie question. Why do we need a shell in Linux? As an example when I type - find . -name xy* - I was told that the shell takes this input and calls the find command (making sure the wild ...
8
votes
4answers
1k views

Bash Shell Tutorials [closed]

What are some good bash tutorials? I would like to learn more about the bash shells commands and how to use them.
8
votes
11answers
13k views

Is there any replacement for putty [closed]

Is there any nice looking terminal with more features and sexy looks than putty? I find it very boring.
8
votes
4answers
1k views

How long is long for the Unix 'file' command?

When you pass a text file to the Unix file command, it might tell you something like: input.txt: UTF-8 Unicode English text, with very long lines Can somebody tell me the minimum number of ...
8
votes
2answers
12k views

Bash not loading '.profile' in new session on Linux

I'm setting up a new Linux machine I got from our IT dept, and noticed .profile is not loaded when I start a new terminal session. The current shell is Bash, though I changed it from the default sh it ...
8
votes
12answers
968 views

Best way to organise one's sh/bash/python/etc. scripts

What is the best way to organise the sh/bash/python scripts you collect and write on your system?
8
votes
5answers
2k views

Will a Mac help me learn Linux?

I worked with a Mac last week for the first time ever. I noticed that the shell is very similar to Linux. I normally develop on a Windows machine and tend to be a noob at all things Linux. Will a Mac ...
8
votes
4answers
5k views

gzip all files without deleting them

I need to gzip all files in a dir separately including all files in sub-directories without deleting the originals afterwards. So let's say I have index.html, I want to have at the end index.html.gzip ...
8
votes
2answers
1k views

How can I prevent tmux exiting with Ctrl-d?

I use tmux on my server and recently I found to my cost that ctrl-d will exit tmux and lose all the session information, my intention was to simply end the ssh session but failed to notice I was still ...
8
votes
2answers
457 views

Can I keep . and .. out of .* expansion?

I often find it annoying (or worse) when I type command .* in bash and the command applies to the parent directory and current directory. Is there some shell option or other configuration I can ...
8
votes
1answer
538 views

why doesn't a bash while loop exit when piping to terminated subcommand?

Why doesn't the command below exit? Rather than exit, the loop runs indefinitely. While I discovered this behavior using a more complex setup, the simplest form of the command reduces to the ...
8
votes
2answers
5k views

Indicating end of Standard Input

How does one indicate that one has finished entering test in stdin? For example, let's say that I wish to encrypt 'blue' using MD5 (I know MD5 is unsecure, but just for this example). I tried user$ ...
8
votes
2answers
707 views

Making bash TAB completion more like cmd.exe [duplicate]

I wondered if theres a way to do rotational style completion in bash similar to the behavoir on cmd.exe, I've found it speeds me up in regard to entering commands
8
votes
4answers
9k views

UNIX shell scripting: how to recursively move files up one directory?

I have a large number of small files, f, arranged in a directory structure like so: /A/B/C/f There are 11 directories at the level of A, each with about 100 directories at the level of B, each with ...
8
votes
1answer
5k views

tee for Windows?

Does Windows provide the basic tee facility for copying standard input to an arbitrary set of files and then back out to standard output? I generally download a generic tee program, but curious if ...
8
votes
3answers
739 views

bash: colorized man page

Where do I have to take a look at in the system to colorize the man pages? The man pages are viewed with less, so I tried adding the following lines to my .bashrc to change the colors: (Which works ...
8
votes
8answers
617 views

Per-directory bash/zsh history log files

I find I do a lot of work on a project in a set directory. Sometimes — a few months down the track — I need to redo something on that project but I can't remember what I did. I use ...
8
votes
3answers
338 views

Is it possible to configure the way bash completes directory names?

I'd like to instruct bash to use a special method to perform completion on certain directory names. For example, bash would call a program of mine to perform completion if a path starts with "$$", and ...
8
votes
3answers
158 views

Windows 7 coming from Linux/Unix?

I've got a Windows 7 box going for my job, and most high-level computing experience is coming from shell environments in Linux. I'm completely lost in the Windows shell, and when I try to use a GUI ...