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
2answers
685 views

How to cut a file to a given 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 ...
10
votes
5answers
446 views

What's the difference between filename and ./filename in Linux

What is the difference between filename and ./filename? Under what circumstances is one preferred to the other?
10
votes
9answers
15k views

Windows Vista: How to execute a .exe program in the cmd “As Administrator”

Yes, that's it. I need to run a program .exe in the dos cmd line and it needs to run like when you right button and select "run as an administrator"
10
votes
9answers
3k views

Determine Linux distribution

I am trying to determine what flavor of linux server is running. I am not trying to determine the kernel version - but rater the distributor. gcc is installed, and in the version output, it says ...
10
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, ...
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
4answers
9k 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?
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
2answers
3k 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 ...
10
votes
4answers
7k 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 ...
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
2answers
245 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
629 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
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 ...
9
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.
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
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
7k 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
3answers
633 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
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
2answers
2k 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 ...
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
3answers
11k 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
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
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 ...
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
11answers
9k 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
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
13k 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
1k 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
4answers
7k views

Parallel shell loops

I want to process many files and since I've here a bunch of cores I want to do it in parallel: for i in *.myfiles; do do_something $i `derived_params $i` other_params; done I know of a Makefile ...
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
6k 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
5k views

How can I found out if file is alias or symbolic link?

I'm working on a legacy system and I have a bunch of files that are referencing images that are located in other folders. lrwxrwxrwx 1 user nobody 56 Feb 10 2010 t100x100.jpg -> ...
8
votes
3answers
736 views

`which python` points to the python I want, but `python` runs the wrong version

I want to use python24 provided by ports, so I've installed it, and python_select -s shows that the version I want is indeed selected. Running which python gives /opt/local/bin/python, and running ...
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
467 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
3answers
3k views

Mouse cursor in Terminal?

I use Mac OS X Terminal.app. But the answer to this would probably apply to any typical UNIX-ish terminal emulator in a graphical environment. Question -- what do I do to: Use my mouse cursor to ...
8
votes
1answer
579 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
744 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