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

learn more… | top users | synonyms

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 ...
8
votes
3answers
374 views

Tabbed terminal that connects to a GNU Screen session?

I use the session feature of screen extensively. For example, I'll start a screen session for "project1" as "screen -S project1", and then when I need to reconnect I use "screen -d -r project1". ...
8
votes
1answer
10k views

How to get relative path from two absolute paths in linux shell?

We have two paths. First one is directory, second either dir or file. /a/b/c and /a/d/e.txt Relative path from first path to second will be: ../../d/e.txt How to get it in linux terminal? PS: For ...
7
votes
5answers
15k views

How do I rename files with spaces using the Linux shell?

I named a number of files with spaces in them, and I want to replace the space with "_". However, every time I write a command in the shell with the file name (eg "Spring 2011"), the shell doesn't ...
7
votes
6answers
2k views

Best practices to alias the rm command and make it safer

Some time ago I erroneously deleted my home folder because I ran a rm -rf * on the wrong terminal, whose working directory was the home folder! I wish I had an alias for the rm command, but it was ...
7
votes
2answers
658 views

How do I delete a file named “-p” from bash?

How do I delete a file named -p in bash? Trying rm "-p" complains that -p is not a valid argument.
7
votes
4answers
278 views

What to use for Shell Access? [closed]

I just purchased a virtual dedicated server-plan that comes with shell access. It's been a while since I've actually used shell access remotely, so I'm a bit behind the times. Years ago I used PuTTY, ...
7
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 ...
7
votes
6answers
4k views

unix - split a huge .gz file by line

I'm sure someone has had the below need, what is a quick way of splitting a huge .gz file by line? The underlying text file has 120million rows. I don't have enough disk space to gunzip the entire ...
7
votes
4answers
431 views

Documenting Unix commands on the command line

I would like to append both the last command and the output of the last command to a text file for the purpose of a tutorial. For example: After I do an ls in my home directory I see this on the ...
7
votes
1answer
1k views

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

In Bash/ZSH and other shells, I am used to using && and ||. Is there any equivalent in Fish?
7
votes
3answers
701 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 ...
7
votes
3answers
454 views

Why I have to type “./” always before an executable to execute it in Linux?

When I compile e.g. x.c by: GCC x.c -o x To execute result I have to write: ./x And just typing: x Fails with this message: x: command not found This means Linux does not search current ...
7
votes
6answers
4k views

Clear stdin before reading

I have the following bash script: # do some time consuming task here read -p "Give me some input: " input Now as you might have guessed, if a user presses some random keys during the "time ...
7
votes
3answers
1k views

How to run Vim command from the shell?

This might be a dumb question, but bear with me. I'm automating some of the usual stuff I do when setting up a new work environment, and would like to automate the Vim command :BundleInstall (for ...
7
votes
2answers
100 views

Is it possible to modify bash to run one command through another (say a python script)?

I was wondering if it is possible to modify bash such that when I type command --arg1 what actually happens is ~/prerun.py command --arg1 (prerun.py would handle starting command --arg1 itself) ...
7
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 ...
7
votes
3answers
8k views

How do I log all UNIX shell commands submitted by all users?

Is there an elegant way to log every command submitted in all shells on a machine? This is in the context of an infrequently-used Ubuntu server, of which I am the only human user. (There are several ...
7
votes
1answer
1k views

ZSH tab completion of git commands is very slow. How can I turn it off?

If I type: rm <TAB> I'll see possible completions almost instantly. However, if I type: git rm <TAB> It'll hang for several seconds if it's in a git repo, or fail to show any ...
7
votes
3answers
830 views

PDF reader for the CLI

I'm looking for a PDF reader that I can use over SSH in a terminal, and have it running in screen. Does such a thing exist? Ideally I'd like at least a less-esque pager but with some PDF formatting, ...
7
votes
2answers
255 views

Why can bash cd to //?

In bash if you cd to // your pwd will be //, but if you cd to / or ///+ your pwd will be /. Is there a reason for this or is it just a weird bug? I have tried this in osx and ubuntu.
7
votes
2answers
5k views

How do I create a shortcut that opens Cygwin bash shell on a directory of my choosing (UNC especially)?

Given a standard installation of Cygwin for Windows XP, I would like to create a standard Explorer shortcut that opens a bash shell already open on a directory of my choosing. The directory is a UNC ...
7
votes
1answer
1k views

Shell script to find all types of files in a directory with their count

I want to write a shell script or alias to find the number of different types of files in a directory. For example, sample output of script should be: *.h 20 *.c 40 *.cpp 10 Makefile 3
7
votes
3answers
749 views

How can I keep the color when I run the external command inside vim?

For example, for the command ls --color displays colorful results when being executed in the shell. However, when I call :!ls --color inside vim, all color information is gone. What should I do to ...
7
votes
7answers
4k views

Screen Capture - command line?

Is there a command line tool out there that can record your computer screen and audio device and then save that to a file?
7
votes
2answers
3k views

Is it possible to set wget to show the transfer times in milliseconds?

Generally, wget shows transfer times in seconds. Is there a way I can to make it show the time in milliseconds?
7
votes
7answers
9k views

Change directory using sudo

How to I change into a directory owned by root? If I do: sudo cd RootOwedDir I get: sudo cd: command not found If I su root I get: authentication failure, probably because I never really set up an ...
7
votes
1answer
298 views

Setting http_proxy for Chromium in shell

In order to set proxy in Chromium browser, one needs to go to Settings → Under the Hood → Change Proxy Settings → Network Proxy. It's too complicated. How do I set http_proxy in shell? I've ...
7
votes
3answers
7k views

Run a GUI app on remote computer from SSH

I want to run a GUI application on my Ubuntu computer, but it should started by a shell script on my Debian server trought SSH. Is this possible?
6
votes
5answers
7k views

Linux command to find files changed in last n seconds.

I would like a Linux command to find files changed in last n seconds. Is there a shell script or other tool that I can run from command line interface or gui?
6
votes
4answers
1k views

What is meant by “$?” in shell?

I am using Debian 6.0. I know the regular command line arguments but couldn't find what $? is meant for? Does anyone have an idea of what is meant by $? in Linux shell?
6
votes
3answers
8k views

How to join files on the command line without creating temp files?

I have two files in a Linux / Bash environment: # Example data $ cat abc 2 a 1 b 3 c $ cat bcd 5 c 2 b 1 d I'm trying to join the two files on the first column. ...
6
votes
1answer
5k views

When using “gzip --decompress”, the result is “gzip: MYFILE.zip: unknown suffix — ignored” on Windows

In Windows PowerShell (if it matters), I would like to decompress a zip file with gzip with the argument --decompress, but unfortunately it doesn't work. Please look at the screenshot below. gzip ...
6
votes
2answers
2k views

Smart tab completion (for directories)?

Are there shell versions that have a more intelligent tab completion? I'd like to be able to type cd foo-<TAB> Then it would show me the possible completions along with numbers that I can ...
6
votes
5answers
6k 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 ...
6
votes
3answers
2k views

How do I kill a forkbomb process?

I started forkbomb from normal user account say - "user1" I'm running a script which says killall -u user1 But it didn't fix the situation.
6
votes
2answers
310 views

How to correct the unrecognizable code in my debian?

After running programs that output unrecognizable code, the whole shell would be full of unrecognizable code. How can I correct this?
6
votes
2answers
4k 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 -> ...
6
votes
1answer
9k views

How can I kill Firefox by console?

I know I can type: ps -A | grep firefox I get something like: 6818 ? 00:04:23 firefox Now I can kill it by means of: kill -9 6818 How can it be done in one command and how can I make ...
6
votes
1answer
1k views

How to escape the At-sign (@) in Bash

Since Apple made a requirement for certain file names to include an at-sign (@) in my iPhone application project, I can't check in my files using the Subversion commandline. How do is escape the @?
6
votes
2answers
623 views

What exactly interpret #!/bin/bash line?

Many scripts in different languages have a #!/bin/bash header with a path to interpreter, so they can be executed without explicit call to interpreter from command line. But what exactly reads this ...
6
votes
2answers
241 views

How can I easily see the man page for builtin shell commands?

If I see a command in a script that I don't know and I type (for example) man pushd or man umask I see the man page for builtin commands. I know that I can do man bash and scroll to find the help for ...
6
votes
3answers
628 views

Is there a shell which supports fuzzy completion as in Sublime Text?

I'm using bash and I was wondering if there is any plugin in bash or other shell which allows me to do this cat tfnislong.txt + [tab] completes to cat ThisFileNameIsSoLong.txt just like tab completion ...
6
votes
2answers
1k views

Writing shell scripts that will run on any shell (using multiple shebang lines?)

I've just started getting deeper into shell scripting, and I've always just thrown my script in a file, marked it chmod +x and then done /path/to/script.sh and let whatever interpreter is the default ...
6
votes
4answers
2k views

Alternative console host for Windows 7/Windows Server 2008

I am often frustrated with the Windows' console host application, especially how clumsily the clipboard works, no-automatic-width issues etc. I would like to know if there is a way to replace the ...
6
votes
1answer
939 views

How do I unset or get rid of a bash function?

If you set or export an environment variable in bash, you can unset it. If you set an alias in bash, you can unalias it. But there doesn't seem to be an unfunction. Consider this (trivial) bash ...
6
votes
1answer
20k views

Bash & 'su' script giving an error “standard in must be a tty”

Folks, I'm having an issue with a bash script which runs a particular command as a different user. The background: Running on a Linux box (CentOS), the script is quite simple, it's starting the ...
6
votes
2answers
300 views

How to connect to a SSH session that was backgrounded with -f -N?

I'm doing some work where I need to pivot off a machine using proxychains so I'm connecting to a system and binding a local port like so... ssh -f -N -D 9000 user@host.com … which returns me back ...
6
votes
4answers
511 views

Is there any functional-like unix shell?

I'm (really) newbie to functional programming (in fact only had contact with it using python) but seems to be a good approach for some list-intensive tasks in a shell environment. I'd love to do ...
6
votes
7answers
388 views

Can I shorten my directory commands in Ubuntu?

When working on a rails app I like to open all of my files through the command line like so CD my_app gedit app/views/user/show.HTML.erb Is there a way that I could shorten this so that I could ...