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

learn more… | top users | synonyms

7
votes
2answers
103 views

how to list current path mode?

If the current path is /data/db_1, and /data has three subpath, db_1, db_2, db_3. I want to know db_1’s modification, owner and group. Currently I use ls -li /data |grep db_1 , but I think there ...
7
votes
3answers
503 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
1answer
5k views

Awk doesn't work when inside double quotes

This command doesn't work: ssh $HOST "ls -l | awk '{print $1}'"` Above ignores the command awk. I think it might be because of the double quotes? Also, how would I add another set of double ...
7
votes
3answers
1k 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 ...
7
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 @?
7
votes
3answers
2k 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
104 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
2answers
12k views

How to change proxy setting using Command line in Mac OS?

I am using Mac OS and sometimes some work need to be done using a proxy so I need to change my proxy setting frequently. But changing proxy setting in System Preferences is very messy. Is there a ...
7
votes
4answers
9k 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

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 ...
7
votes
4answers
6k views

Get the parent directory for a file

I want to get just the name of the parent directory for a file. Example: When I have path=/a/b/c/d/file, I want only d and not /a/b/c/d (which I get from dirname $path) as output. Is there any ...
7
votes
2answers
7k 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
3answers
1k 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
269 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
1answer
2k 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
1answer
252 views

How can you reverse the direction of alt-period in Bash?

In Bash, you can press Alt-. to insert the last argument of the previous command. If you press it multiple times, it cycles through the last arguments of all of the commands in your history. However, ...
7
votes
2answers
4k 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
3answers
2k views

re-use '~/.profile` for Fish?

(I'm talking about the shell Fish, esp. Fish's Fish.) For Bash/ZSH, I had ~/.profile with some exports, aliases and other stuff. I don't want to have a separate config for environment variables for ...
7
votes
1answer
19k views

HOSTNAME environment variable on Linux

On my Linux box (Gentoo Linux 2.6.31 to be specific) I have noticed that the HOSTNAME environment variable is available in my shell, but not in scripts. For example, $ echo $HOSTNAME returns ...
7
votes
1answer
113 views

What do these cryptic strings really mean in registry associations?

Looking at my HKEY_CLASSES_ROOT\Word.Document.12\shell\Open\command\command value (Word 2010 'Open' shell association) I see this sort of nonsense: ...
7
votes
1answer
369 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 ...
6
votes
5answers
16k views

How do you get a shell on a Mac?

I have never used a Mac before. I recently went to an Apple store and tried to open a shell to try it out. But, I was not able to open a shell - no shortcut for it, not right-click-menu entry, ...
6
votes
6answers
9k views

How do I set $ variables in unix?

For example there is a long path that I cd to very often. How do I store the path in a variable so that I can use it everytime? For example: I wan to be able to do this cd $path instead of cd ...
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
7answers
599 views

Remove linux file named with set of shell responsive characters

I've created a file named \;:$"\' to test a software of mine. I ended up with an error because I cannot delete the file property. I'm trying to find a precise char combination to remove via rm, but I ...
6
votes
4answers
6k views

Unix command to list all directories larger than 10mb

Is this possible, and what would the command be?
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
198 views

Differences in bash scripts between $@ and $*

Which are the differences between $@ and $* ? For example I see no differences here: #! /bin/bash echo with star: $* echo with at sign: $@
6
votes
3answers
2k views

Using wildcards in commands with zsh

Using commands such as rsync and scp with ZSH I've run into trouble. Instead of the (normal) behaviour of giving me all matching files, it won't run and returns: ➜ ~ rsync -azP user@server:~/* ~/ ...
6
votes
2answers
3k views

GNU Screen: Can't stuff commands unless the screen is attached?

I have the following script screen -d -m -S $1 #start screen minimized screen -S $1 -X stuff "$beast " #stuff commands unless I attach the screen ...
6
votes
4answers
2k views

Set $PS1 differently on local computer and in ssh session

I keep my home directory under version control, so that my basic configuration is easily available on any computer. My bash command prompt on my local computer is a complicated, colorful thing that ...
6
votes
3answers
397 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
1answer
10k views

du only for directories

In C-Shell, how can I get the same output as du -sh ./* but without listing the files in the root dir, i.e. just a list of subdirectories in ./ and the sizes of all their contents?
6
votes
2answers
801 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
554 views

What is the equivalent of bash's !$ and !! in the fish shell?

I've been using bash for a decade or so and have gotten used to being able to type !$ to repeat the last argument, e.g.: $ mkdir foo $ cd !$ cd foo (That last line is printed by the shell to tell ...
6
votes
2answers
215 views

Can I have a bunch of tabs set up when I launch Terminal?

Every morning I launch the OS X app Terminal and tediously set up a bunch of tabs... A ssh session to a certain server ($ ssh ...) A script/console session for the Rails app I'm working on ($ cd ...
6
votes
3answers
7k views

shell scripting - How to zip contents inside a folder without the folder itself?

I use this current command that archives the folder "folder-root" and all it's content to a file named "site.zip": zip -r site.zip folder-root/* Problem is - I want to zip the contents of the ...
6
votes
2answers
462 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
1answer
3k views

Bind keys for scrolling pages in copy mode in tmux

I'd like to be able to map emacs keys (like C-v/M-v) for scrolling in tmux instead of default PgUp/PgDown, is that possible? Can't see that from the manual at the moment (apologies if its there, seems ...
6
votes
3answers
41k views

Run a shell script with an html button

I want to launch a bash script when a button is pressed on a website. This is my first attempt: <button type="button" onclick="/path/to/name.sh">Click Me!</button> But no luck. Any ...
6
votes
1answer
23k 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
4answers
1k views

How do I combine stdout and stderr for different shells?

I know the answer for some shells, e.g. with cmd.exe you can: some.exe > out.txt 2>&1 How do you achieve the same for other shells (bash, ksh, tcsh, powershell, etc)?
6
votes
5answers
9k views

rsync using regex to include only some files

I am trying to run rsync to copy some files recursively down a path based on their file name pattern, case insensitive. This is what I have done to run rsync: $ rsync -avvz --include ='*/' ...
6
votes
4answers
3k 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
7answers
460 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 ...
6
votes
2answers
772 views

Potential issues with adding /usr/local/[s]bin to root's path?

I've noticed that the root account $PATH does not include /usr/local/bin or /usr/local/sbin by default. Are there any potential issues that could arise from adding those directories to the path? If ...
6
votes
4answers
6k views

double-click to run .sh file

GUI: I changed the permissions of an sh file, so that I can read, write and execute it. I double-clicked it, selected run in Shell / terminal (whichever appears in english), but it didn't run. I ...
6
votes
6answers
2k views

What are the common Control combinations in a terminal setting

I would like to have a good guide to the common Control key combinations in use in bash (and similar) shells and the combinations used by common programs in use in those shells. My particular ...
6
votes
1answer
2k views

Runing a command without inheriting parent's environment

Is there a way to run a command "as if" it is in a new login session? I've already tried env -i. However, I don't want to deal with various ENV variables I have to set or unset. I've also tried bash ...
6
votes
3answers
1k views

what does it mean a red filename shown with black background?

I have a compilation problem, and when I check my lib/ directory I get this output from "ls": What the red/black combination mean? I checked in the output of "dircolors -p" as suggested here ...