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

learn more… | top users | synonyms

2
votes
2answers
2k views

Working with git via crontab

I have the following shell script #!/bin/bash REPODIR=$HOME/work/repository/ cd $REPODIR var=`git fetch --dry-run 2>&1` echo $var > $HOME/error.txt I want to run my script every minute, ...
1
vote
1answer
212 views

Why should I not make each individual shell I run a login shell?

I've been told by numerous people that I shouldn't make each shell I use a login shell. Wether via a TTY, or an Xorg terminal app running bash.. can anyone explain the potential reasoning behind this ...
1
vote
1answer
548 views

run a shell script on terminal if terminal is idle for few minutes in linux

i can get terminal idle time by w command as follows $ w 14:37:58 up 2 days, 20:16, 2 users, load average: 0.12, 0.16, 0.14 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT ...
3
votes
2answers
1k views

Windows 7 & Git Bash: Doesn't Recognize pear/phpunit

I can run pear/phpunit from "cmd" just fine. I checked %PATH% and everything that is there is also in $PATH. To be clear, this is not msysgit -- It is this: http://git-scm.com/downloads Anyone know ...
1
vote
3answers
96 views

Is there more elegant way to find out what's another user's default shell?

Is there more elegant way to find out what's another user's default shell (assuming that I have root privileges and using GNU/Linux)? I'm aware that I can get the answer by looking/parsing/greping/etc ...
1
vote
2answers
9k views

Is it possible to shutdown remote Computers without inputing the password?

I used the following bash to shutdown remote computers,but for each computer,I must input the password for it.Is it possible to input the password Automatically? #!/bin/bash ssh -t ...
0
votes
1answer
515 views

How can I both use and modify the history inside a bash script?

So I have the following bash script aliased as "fortunes": #!/bin/bash -i REPLY=; history -w /tmp/fortunes_history_backup; # save history ... history -c; # and clear it. while [ ! \( "$REPLY" = "q" ...
2
votes
3answers
492 views

Shell script not running as by “./” but it runs by “sh”

I am running a script on arm target board as a super user, i.e., as a root user. But the script is not executing if i run it with following syntax root@freescale$ ./Script.sh -sh: ./Script.sh: ...
-4
votes
2answers
3k views

“rm -rf /” VS. “mv -r / /dev/null”

Might be a stupid question, but what would be the worst for your system ? (I think both) But to my opinion mv would be the fastest to "delete" it all. Am I wrong ? (don't wana test aniway ^^ )
5
votes
4answers
11k views

How to rename multiple files in a directory in some pattern in Linux?

I have a directory which has files with random names. What I want to do is rename the files with file1, file2 and so on.The lexicographically smaller file name should be numbered with smaller number. ...
0
votes
2answers
86 views

How to change the definition of word separators for the shell?

Is there a way to change the definition of the word separators in bash? This will allow me, for example, to do ctrl+w (delete previous word) at the end of this path: /some/path/of/some/file ...
4
votes
1answer
549 views

Bash: color prompt and command differently from output stream

I'd like to color the prompt and command of my shell differently from the text printed in the output stream. My current export for PS1 is as follows: export PS1="\e[0;36m\h:\e[m ...
1
vote
4answers
4k views

How do you pass a file or folder containing whitespace as an argument to a command-line program in a GNU/Linux or Cygwin environment?

There are occasions when you are working with files and folders that contain spaces in them. The problem is any time you try and pipe files / folders containing whitespace to another command-line ...
1
vote
3answers
278 views

How to create a series of commands in shell, which will stop execution on error

My usual git workflow for deploying is the following: [while on master branch] git pull git push git checkout production git pull git merge master git push Would it be possible to create a ...
1
vote
0answers
75 views

Bash Shell doesn't recognize the letter “t”

I have Cygwin running on a Windows 7 Box. In what is a relatively new (and strange) development, the bash shell stopped recognizing the lowercase "t". For example: I type echo cat, output is ...
2
votes
2answers
133 views

UNIX-Shell Scripting

While executing the below script, I'm getting an error: Syntax error at line 1 : `(' is not expected. sudo su - user1 -c "cd $HOME ; tar -cvf $HOME/mine.tar `cat /tmp/$LOGNAME/List` " where List ...
4
votes
1answer
195 views

Is there any benefit to exiting nested SSH sessions, as opposed to closing the entire terminal application?

The question should hopefully sum things up, but essentially, I'm in a bunch of SSH sessions, some of which have additional SSH sessions to other hosts. Are there any negative impacts to simply ...
9
votes
3answers
4k views

Why doesn't '>' redirect error messages from gcc?

I stored the following program in new.c int main() { a; return 0; } It returns an error message. I want to send this message to a file. So I used the following command gcc new.c > ...
1
vote
2answers
755 views

Why does echo * | rm -f not work?

Why does echo * | rm -f not work? as per my understanding, echo * should list all the files in the directory and pipe should send this list as an argument to the rm -f command, which should delete the ...
3
votes
3answers
58 views

Can I cycle through the history of shell commands that have only been used from current directory?

So when using arrow up/down to cycle through prior commands, is there any way I can limit those to the commands used from the current directory? This would make my life 10 times easier...
1
vote
3answers
146 views

Directory /ETC has been moved! — Ubuntu 13.04

I made a bad move by moving my /etc directory to Dropbox in hopes to sync two computer enviroments. After moving the /etc directory any sudo commands responded with "Who is this UID 1000?". Basically ...
4
votes
4answers
900 views

Is it possible to use a shell script in the sendto folder?

I would like to use a bash shell script from the SendTo folder. When I put a shortcut to a batch or exe into theSendTo folder it shows up in the shell Send To context submenu, but when the shortcut ...
1
vote
1answer
270 views

zsh running a comand but not from the path

My zsh is doing something odd, it is running an executable that is not the first executable on my path. I have a wrapper script for ssh but the wrapper is not being invoked while the real ssh binary ...
1
vote
2answers
907 views

linux COM port write and read

I have a COM port connected to my Linux host, namely /dev/ttySx, how can I simply write and read some data from this COM port in shell, like use echo and cat command?
4
votes
4answers
447 views

How can I find a path by providing only part of the path?

Let's say I need to find this path /<some_where_in_root>/find/this/path and the only information I have is /find/this/path. What would be the best means of locating the full directory? I ...
0
votes
1answer
35 views

how to display I/O file on shell

I am writing shell script and I need to display my output at the same time however it doesn't work with 2> somefile.txt and if I do | tee -a somefilel it will not overwrite which I need to . <> ...
27
votes
7answers
74k views

How can I use a bash like shell on windows

I use Linux and a Mac. I'll be teaching some command line stuff soon. What can I install on Windows to give me a terminal window most similar to a basic mac/linux bash shell. Would like to be able to ...
11
votes
3answers
17k views

Windows & Git Bash: Bash PATH to read Windows %PATH% system variable

I've recently added a directory to the Windows PATH manually by going into Control Panel -> System -> Advanced system settings -> Environment Variables -> User variables -> PATH. (Windows 7, 64-bit.) ...
3
votes
1answer
505 views

How to benchmark bashrc / zshrc and prompt rendering time?

As im currently experimenting with new stuff in my prompt i need a way to tell what the performance impact is. How can i monitor how long it takes to render my prompt and the time it takes to source ...
0
votes
0answers
126 views

libssh vs alternative root users

Here is an excerpt of the /etc/passwd file on a remote machine. root:x:0:0:root:/root:/bin/bash valid:x:0:0::/home/valid:/bin/rbash As you can see, valid is an alternative name for root. I can ...
-1
votes
4answers
3k views

Does Windows 8 have explorer.exe?

I am considering buying a new laptop. I am a big fan of Windows 7 and I am reluctant moving to Windows 8. One key feature I use on Windows 7 is explorer.exe. Is this application still available on ...
2
votes
5answers
98 views

File name starting with *\*

I have some weird file in my home directory which name is \e[m. I am using Linux. How can I delete it because I tried rm but it says no such file or directory found?
0
votes
1answer
281 views

Automatic autorestart Firefox on close

I want firefox to restart automatically when I close it. I found this script #! /bin/sh while [ true ]; do firefox done and I put a file with that script in the /etc/init.d folder. Firefox ...
0
votes
1answer
180 views

rsync options to exclude deletes

I backup my files from my desktop to my FreeNAS box with rsync. Here is the command I use: rsync.exe -v -rlt -z --chmod=a=rw,Da+x --delete --exclude="Torrents/Downloads" --exclude="Torrents/Watch" ...
1
vote
1answer
485 views

Linux shell to execute keystroke (CTRL+C)

I've been encountering a problem while trying to simulate "Ctrl + C" within a bash script. Basically, I am trying to simulate keystrokes after another command has been run. While I seem to have no ...
1
vote
1answer
549 views

How to render two columns preserving all whitespace after the first column with awk or alternative?

my output comes in human-readable figures with one space followed by directory names: I am currently using ... awk '{ printf "%-20s %-40s\n", $1, $2 }' input 1G foo 1.5M foo baz 5K foo spaces in ...
1
vote
2answers
440 views

How to merge ls commands colors with the output of find or du?

I have a simple alias to list the size of files&folders in cwd. ( including dotfiles in this case , ignoring zero sizes ) du -sh .[!.]* * | sort -hr | grep -v '^0' which can be achieved ...
0
votes
1answer
484 views

Selecting all text in Vi/Vim through PuTTY

I need to select the text in a log file (~900 lines) and paste it into a normal text file. However, I am on my server via PuTTY so when I do :%y+ or gg"+yG it does not let me paste it. By any ...
0
votes
5answers
457 views

UNIX: Merging files with different extensions to one file

For example: In my /temp directory I have 100 files.. 50 with the extension of .msg and 50 with .xml. /temp/test1.xml /temp/test2.xml /temp/test3.xml ......... /temp/test49.xml /temp/test50.xml and ...
0
votes
2answers
36 views

linux command mapping for long path dependent ones

I'm sorry if this question is asked in a different way before. I did my due search effort on Google and StackOverFlow(SOF), but the search terms that I tried haven't returned the answer I was looking ...
0
votes
1answer
433 views

Emacs, Zsh and Ansi-Term — weird chars

My issue is illustrated in the follow images: This is the visual representation I get in my iTerm of my Zsh shell, with the same font as used in Emacs: This my my Emacs output using ansi-term: ...
0
votes
2answers
888 views

bash: variable name not being expanded with Tab completion

On a remote computer with bash version "3.2.51(1)-release" (OS: SUSE Linux Enterprise Server 11.1 (x86_64)), I could not do a usual tab completion with variable name. for example, I'd like to type: ...
0
votes
1answer
106 views

How to use arguments with 'find -exec'?

I'm trying to generate static html files for all php scripts inside dir: find . -name "*.php" -exec php {} > {}.html \; But it just dumps all results to {}.html. How to do it properly? And how ...
1
vote
1answer
2k views

Using rz and sz under linux shell

Anyone knowns how to use rz and sz under linux shell? I can use it under sercurecrt, but not ubuntu shell. Here is the screenshot.
0
votes
2answers
527 views

When I grep no particular file the terminal stops working

I'm learning how to use the shell. In playing around with some basic commands I encountered an issue. This is pretty basic stuff and I apologize if that upsets some folk. On my desktop there exists a ...
2
votes
3answers
273 views

How do I prevent $PATH from resetting itself each time?

I'm having difficulty setting up the PATH on my macbook pro. I followed this link to modify my path variable. Each time I start a new terminal I get a PATH pointing towards ...
2
votes
1answer
2k views

How do I install/make a custom prompt for fish shell?

I'm using fish 2.0 in #! Linux, but this might be an installation error, since my ~/.config/fish/config.fish is empty.
3
votes
2answers
2k views

what is -z option in test command(linux)

In one of my lab tutorial there was a command to be checked. test -z $LOGNAME || echo Logname is not defined when I execute this command the output is "Logname is not defined". Man page for test ...
0
votes
1answer
186 views

How create an account for myself as administrator (sudo)

I have sudoer root access and would like to create one new admin account for myself and one regular account without full access! on the command line I can use $ adduser USERID I tried $ visudo and ...
2
votes
3answers
657 views

How to make zsh completion like bash

I am using zsh. It is a nice shell, especially for the auto completion function. But, when I press tab, it always auto fill with the first completion option. For example, there are two files in my ...