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

learn more… | top users | synonyms

14
votes
2answers
4k 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 ...
12
votes
3answers
3k views

Making Linux shell prompt show last return value

I'm currently on a Linux machine and the shell prompt is showing me the last return value and number of executed commands (picture included, with these numbers shown in purple). My own computer ...
0
votes
1answer
433 views

Schedule tasks via shell in mac os x

I am writing some C++ code and would like that every 60 minutes, the code is "uploaded" to my external SVN repository. For doing this I just do "svn ci -m "some comment", but I want to do it ...
0
votes
1answer
257 views

How to get Quicklook to open shellscript as source

I typically have a set of shell scripts with no extensions. Something like: git-completion git-flow git-addremove ..etc.. All these script are written in bash. When I use Quicklook on them it shows ...
22
votes
1answer
5k 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 ...
3
votes
4answers
497 views

How do I use the terminal to log into another mac?

I have some Bash scripts that copies files from one mac to another trough the LAN, but I need to be logged on to the other mac for the scripts to work. It's a bit cumbersome to go trough Finder to do ...
2
votes
3answers
149 views

How to move different types of files to a different directory in shell

I have a mix of different files in my folder and I thought I can simply do: mv '*.(png|jpg|gif)' images/ to have them moved to the image folder. But it doesn't work... any thoughts?
7
votes
2answers
5k views

Shell SIGKILL Keybinding

How can I setup a keybinding to send a SIGKILL to the current foreground job? I already know that Ctrl+C is SIGINT and Ctrl+\ is SIGQUIT. I would like a more severe option. Is there anything ...
4
votes
3answers
11k views

Remove files from remote host using SSH

I need to delete all files inside a remote directory using SSH, The directory itself must not be deleted, so @Wes' answer is not what I need. If it was a local directory, I would run rm -rf dir/*.
2
votes
1answer
771 views

How to specify shell for vim?

Can I specify my shell for vim? I'm running OS X and have zsh installed via Homebrew and am using MacVim. When I type shell in MacVim, the shell opens up as bash. How can I have it open as zsh?
1
vote
1answer
234 views

nanobsd.sh outputs ': not found'

[root@bsd /root]# uname -a FreeBSD bsd.localdomain 7.4-RELEASE FreeBSD 7.4-RELEASE #0: Thu Feb 17 03:51:56 UTC 2011 root@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 When I run, ...
6
votes
4answers
2k 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?
14
votes
7answers
1k 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 ...
5
votes
2answers
13k views

“bad interpreter: Permission denied” How can I prevent this error?

I want to run program directly such as ./program without define the interpreter in shell first. so, how can i want to prevent this error? bad interpreter: Permission denied My operating system ...
2
votes
2answers
730 views

How run sudo -s after ssh login

My Step By Step: On myserver.com i paste line "sudo -s" to file "~/.bashrc" in home directory for "mylogin" SSH Login to mylogin@myserver.com After login: root@myserver.com:~$ But, press cntrl+D ...
3
votes
1answer
3k views

How to uninstall zsh

Is there anyway to uninstall zsh? I wasn't able to upgrade it so I want to uninstall it then install it using brew.
0
votes
1answer
66 views

How do I set what should happen in terminal on a certain command?

If I execute cal 2013 in terminal, it echoes the calendar for the year 2013. For the matter of fun, I'd like the terminal to echo This year won't come. How should I do this? I tried adding ...
4
votes
1answer
525 views

Context menu edit - “Create new xxxxx”

I am trying to find a way to create a context menu entry in which I can right-click on an .mp3 and have the option to create a folder based on the name of the file. I.e. Create New Folder "Artist". ...
6
votes
1answer
9k views

Unix : List children processes for a given pid

What I need is, given a process id, list all his children without any clutter (table header, other columns than the pid) What I have is : ps h --ppid $PID Which gives me: 26277 pts/13 S+ ...
3
votes
2answers
6k views

Find out path of program

On Unix I can call certain programs from everywhere, like sort, pwd or my_custom_script.sh. How can I find out, where on the system my_custom_script.sh really resides?
1
vote
2answers
2k views

Bad shell script interpreter? Works sometimes

I have a weird situation where some of my shell scripts that use #!/bin/sh as the shebang sometimes work - other times they yield the following message: bash: ./newshit.sh: /bin/sh^M: bad ...
3
votes
1answer
378 views

Confusion about using fractional +n, -n or n in find options -amin, -atime, -cmin, -ctime

I am not sure if I understood the way find ignores the fractional part when using one of these predicates to find. For e.g. I used $ find . -ctime .2 # files status changed exactly 4.8 hours ago ? $ ...
3
votes
3answers
15k views

How to create a new terminal window from the command line in Red Hat Linux 5.3

I use PuTTY to get to my Red Hat Linux 5.3 workstation from my Windows laptop. Typically, if I want a new terminal on my Windows 7 workstation from another terminal or mc, I have to type start ...
1
vote
2answers
2k views

Generating a timestamp to usec accuracy in shell (Busybox)

I want to generate a textual timestamp in the unix shell with microsecond accuracy, without using the %N date option (I am using busybox, a smaller unix toolset that does not have this option), to ...
0
votes
1answer
145 views

Change order of folders in the windows shell

In the shell of Windows 7, can I change the order of the folders displayed on some hierachy level? E.g., in Documents, I might have folders a, b, c, d, e and want to have the order a, c, e, b, d.
12
votes
3answers
9k 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.
6
votes
1answer
2k views

Is the invisible text bug in bash a bug or a feature?

On every single linux distribution I have used the last 10 years there has been the following inconvenience: You run a program in the terminal using bash. After the program is stopped or interrupted, ...
2
votes
1answer
61 views

How to change terminal to include <time of day> and <pwd>

How can i make my shell prompt read: <pwd>$ <time of day>
8
votes
1answer
3k views

versions of netcat

I've tried the two main versions of netcat : GNU and BSD. (mine is BSD Version). On GNU version, the command $ nc -l -p 12345 works fine but with BSD, option -l (listen) can't be used in conjonction ...
7
votes
4answers
11k views

Linux: neither chsh nor ypchsh is working, can I change my shell?

I'm an old-school Unix guy, so my Linux skills are probably slightly out-dated. But this seems like it should be simple enough. On a Red Hat Linux system where I do not have root (it is administered ...
0
votes
3answers
118 views

What happens if I set my shell to be an invalid program and restart?

If I change my shell to be something like /bin/abc, where abc is something random (or may not even exist), what happens when I login (assume that I have added it to /etc/shells, so chsh won't whine.)? ...
6
votes
1answer
2k views

#!/usr/bin/env Interpreter Arguments — portable scripts with arguments for the interpreter

Because interpreters such as zsh, bash, python, perl may be located in different places on the filesystem, scripts often have a shebang that uses env for portability, e.g. #!/usr/bin/env zsh. ...
0
votes
4answers
1k views

Remove files that don't end on “.py” using rm [duplicate]

Possible Duplicate: Remove all files but one with rm This is a very simple question and i dont know whether a solution exists or not. I have some files in a directory, assume i have .py ...
4
votes
3answers
985 views

Why is reading a FILE faster than reading a VARIABLE?

I don't understand the results of a simple performance test I ran using two basic scripts (running on a high end server): perfVar.zsh : #!/bin/zsh -f MYVAR=`cat $1` for i in {1..10} do echo ...
5
votes
1answer
8k views

How do I clear all environment variables from a Windows shell session?

If I start a new Windows shell session and type: env I see lots of environment variables set. I want to debug the running of a command line program by removing all environment variables from the ...
12
votes
11answers
19k 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.
2
votes
3answers
90 views

Which versions/configurations of Microsoft Windows include the “where” command?

This question came up in the context of answering a programming question on Stack Overflow. where is a handy command to locate a file on the path, roughly equivalent to the Unix which. My Microsoft ...
8
votes
6answers
7k 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 ...
0
votes
2answers
561 views

linux(ubuntu) shell window width

anyone knows how to change the default width for shell window in Linux(Ubuntu), so that I don't have to re-size it every time I open it up? Thanks
0
votes
1answer
901 views

Iptables prerouting and IP forwarding

I have a linux machine used as gateway for a Win XP machine. Both are in Virtual machine for testing purpose. Now I want to trick the Win XP user (me) with the forwarding of an IP address: I want to ...
0
votes
1answer
1k views

supply password in crosh (chrome os shell) ssh?

I have a CR-48 and I'm attempting to connect to SSHdroid. I understand the standard command for connecting to SSH is ssh root 192.168.2.bla but how do you supply a password along with that command ...
3
votes
1answer
535 views

Custom syntax highlighting in Bash shell (using keywords)

I know it's possible to change the $ user@hostname colors, but is it possible to color different things? Could I make all numbers/integers a certain color. Or set certain keywords to be bold?
2
votes
1answer
100 views

Linux Rights issue

Firstly, I am running all of these commands through www-data user..which is apache2 user... Using php, and exec function to run these commands... I create the directory mkdir -p testing Now lets ...
1
vote
1answer
1k views

csh cd alias: how to eliminate error when no parameter is supplied

I am familiar with bash, but my works require csh. in my .cshrc, I created this alias: alias cd 'cd \!:1; ls -l' It works very well except for one case: when I cd without any parameter: cd In ...
1
vote
2answers
745 views

shell script post commit hook that just does date > /tmp/post-commit.log nothing is written to log file

I installed svn server with apache 2 on ubuntu 10 i have created a post-commit.sh with a single 2 lines of code repository/hooks/post-commit.sh: #!/bin/sh date > /tmp/post-commit.log nothing ...
2
votes
2answers
2k views

Extract a zip file to your own directory

Im trying to extract the contents of a zip file but I want to extract it to my own directory. I'v tried -d from unzip but that just puts the contents of the zip into that directory. But I want to ...
2
votes
3answers
2k views

How do I su to user login shell directly

I do the following many times a day I login to a server via ssh as user1, I then do su - to become root, then I do su --login user2 to become user2 Is there a way to tell su to go to user2 ...
96
votes
8answers
52k views

Reload a Linux user's group assignments without logging out

When assigning a user's secondary group list using: # usermod -G <grouplist> <user> is it possible to force this group assignment to take effect without logging out all running ...
0
votes
1answer
2k views

How to copy files and directories while retaining file permissions in UNIX

How can I copy files and directories from one user to another user on a unix system so that the file permissions don't change? The recipient is not the owner, but I have root permissions. Thanks.
1
vote
1answer
356 views

Which linux environment varaiable gives the path to the users desktop?

It turns out that different languages can have a path to the desktop folder. ~/Desktop is ~/Työpöytä in Finnish What way via the shell can I get access to the translated folder?