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

learn more… | top users | synonyms

1432
votes
7answers
151k views

How do I make a machine “blank screen” for a period of time (as a penalty) if certain noise levels are reached?

My kids (4 and 5) yell a lot when playing games on the computer. I found an effective cure for this. When I hear loud noises, I ssh into the game computer and do: chvt 3; sleep 15; chvt 7 This ...
1
vote
1answer
2k views

how to connect to secured wireless network connection in cmd in windows?

I program on C#, I don't want to use P/invoke, so I will use shell, so I need to connect to a secured wireless network connection on the CMD in windows, I know how to connect to a wireless network but ...
1
vote
1answer
109 views

Testing vimscript

I'm hacking on a test framework for vimscript (an exercise in futility, I know; humor me). Some vim plugins make calls out to the shell (with the system() function or the ! command). I want the test ...
1
vote
4answers
1k views

Unable to make bash default shell in freebsd

I wanted to change my default shell to bash in freebsd. I tried the following: 1.chsh -s /bin/bash (or /usr/local/bin/bash) <my_username> I get this error after entering the password: chsh: ...
9
votes
1answer
17k 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 ...
1
vote
3answers
2k views

Shell script works directly, but has a syntax error via crontab

I have a shell script to automate a git commit and push every night: auto_git_push.sh #!/bin/sh function automate(){ git add . git commit -am "automated push $(date +"%Y-%m-%d")" git ...
3
votes
3answers
3k views

What's a reliable technique for killing background processes on script termination?

I use shell scripts to react to system events and update status displays in my window manager. For example, one script determines the current wifi status by listenining to multiple sources: ...
5
votes
1answer
2k views

What are commands to find shell keywords, built in functions and user defined functions?

I was discussing with my friend on how the commands are parsed in the shell, and he told me that bash searches the command in following order List of aliases List of shell keywords List of user ...
3
votes
2answers
170 views

Do aliases slow down a shell's start?

Sometimes my shell (zsh) takes longer to start than usual (I open the terminal, and it hangs a bit until I can input commands). I have a few aliases on my .zshrc (well, actually they're in a ...
8
votes
3answers
6k 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 ...
0
votes
1answer
286 views

Passing User's aliases to root while doing “sudo su”

Is it possible? I could make an alias to sudo su -;source .bashrc but it seems like source .bashrc is executed in the earlier shell and not in root's sheel (Why?)
2
votes
1answer
2k views

How to redirect multiple bash commands to a variable AND screen?

I would like to capture a subshell's output in a variable and print it in the terminal screen simultaneously. Is it possible to do this by assigning the subshell to a variable and piping stdout and ...
3
votes
2answers
138 views

Very Simple Script to Remove Last 5 Lines of a Series of Text Files

For some reason this script outputs three files for each original, rather than one. Must have made some trivial error - I'm new to this! Much obliged if anyone could explain why this happens. ...
1
vote
1answer
3k views

init.d script for OpenOffice / LibreOffice headless does not stop process

I am using Ubuntu and found this init.d script for LibreOffice headless. Problem is that it does not seem to be stopping the process when asked to "stop". Any help greatly appreciated. Two other ...
2
votes
3answers
445 views

Using find, xargs, etc. to output similarly named files

I have a folder full of HTML files: 001.htm 002.htm 003.htm … I want to run Pandoc on them to convert them to similarly named Markdown files: 001.md 002.md 003.md This command works on one of ...
1
vote
1answer
2k views

Autologout after logging in

I have a Ubuntu 10.04 LTS server. I'm currently logged in as root, because I suddenly cannot log into my account anymore. When I execute su useraccount, nothing happens. The log file auth.log ...
4
votes
1answer
378 views

Way to move cursor by arguments in bash?

In bash, you can use M-f and M-b to move the cursor one word forward and backwards, but is there a way to move one argument forward or backwards? If not out of the box, perhaps by some configuration? ...
2
votes
1answer
902 views

SSH Session Started from Here Doc Does Not Exit Properly

SSH session doesn't terminate and give the tty back when executed inside a here document. Below is the code snippet that's inside my shell script: ssh -t -t root@$HOST_ADDRESS <<TERM_STRING cd ...
6
votes
2answers
265 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: $@
11
votes
4answers
13k 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 ...
3
votes
3answers
155 views

Transparent usage of temporary files as means of piping [closed]

As many of us are surely aware, it's always a good idea to make your program accept stdin input. Very many programs do allow that *nix environments. This lets us do cool things like piping echo "foo" ...
4
votes
3answers
475 views

why “cd -” in .sh file will print the address

I use "cd -" to switch between folders. like: cd /etc/ cd - but why "cd ...
0
votes
2answers
629 views

How to permanently reset my $PATH?

I was trying to add something to $PATH and it went totally wrong. I now can't run any commands such as ls. I've looked at this answer ...
5
votes
2answers
964 views

Windows Explorer: Customize view settings via batch or shell-extension?

In folders with shortcuts (and junctions) I oftenly like to have mid-sized icons, sorted names and grouping by type. Alas, Explorer oftenly forgets these settings once I made them manually. The ...
3
votes
2answers
1k views

Using paste command to join with multiple character delimiter

I have a file which gets generated based on the arguments and it has the following contents. 2012-12-31 2012-12-30 2012-12-29 Now, these are actually date partitions for hive query. So, I want to ...
0
votes
1answer
80 views

How do I specify the screen-name for a command (Gnu-Screen)?

If there are 2 gnu-screens, with the name: screen1 and screen10. If we want to do something with screen1, I can't, because if I try as example to print something to the screen, it will say that there ...
0
votes
6answers
1k views

grep *.c not working

I have a list of ".c" (c files) in the current directory. I have to find all the .c files in the current directory. The command that can be used id ls *.c But, another way is to use grep. so if i ...
3
votes
3answers
212 views

Run command on shell and get output in vim

I know how to run shell commands within vim using :!r and :!, but is there a way I can do that from outside, i.e. from bash? Something along the lines of vim 'ls -al'. The output of ls should be in ...
2
votes
1answer
189 views

Copy all files in a folder which have the same name as files in a separate folder

Let me explain: I am going through a huge icon set, and choosing the icons I like. I have chosen maybe 250 out of 3000 icons. The way the icons are split up are like this: Icons -> 16x16 ...
0
votes
2answers
182 views

How can I run a command on disk error?

System: Debian Squeeze What's it for: A System where any new disk is DoD Wiped. I'm looking for a method to fire a command on a disk error that the kernel throws, sometimes we get bad disks and it ...
0
votes
2answers
2k views

Capturing the console output

I am running a Hadoop hive query from shell script. This is how I am doing it in my shell script. echo "SELECT COUNT(*) FROM test" | hive I want to capture the output whatever hive command outputs. ...
-1
votes
3answers
664 views

A file which is not a dir nor a file

This may look like a weird question, but I just got this output for a file (directory?) in my system. This may be a trivial or well-known error, but for me, this file (directory?) called ...
7
votes
5answers
15k 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 ='*/' ...
0
votes
1answer
3k views

How can I manually set the CPU frequency?

I have tried the following from shell: cat scaling_governor userspace cat scaling_available_frequencies 3326000 3325000 3192000 3059000 2926000 2793000 2660000 2527000 2394000 2261000 2128000 ...
1
vote
1answer
853 views

PDF Shell Extension Handler [duplicate]

Possible Duplicate: How can I view and sort after the page count for multiple PDF files in a Windows file explorer? Is there any Shell Extension Handler for Windows 7 64b, that can show PDF ...
0
votes
3answers
7k views

How to grep logfile via SSH on multiple servers?

Sometime, I need to find out specific log content(such as api call) from log files, those log files exists in several Linux servers. I have to use SSH to login every server and use grep searching the ...
1
vote
2answers
485 views

zsh completion doesn't work under Cygwin for other drives

I'm on Win7 x64, Cygwin 1.7 and zsh (and using oh-my-zsh). Zsh newbie here. I've reviewed zsh autocompletion not working on cygwin and tried the solution there but no luck. My mount table: C: on ...
0
votes
2answers
102 views

rsync {braces} fail?

I need some help in this issue: I want sync /path/first/ with /path/second/, /path/third/ ..etc so I've tried this: rsync -rv /path/first/ /path/{second,third,fourth}/ But it worked only for last ...
2
votes
1answer
89 views

How to list all scripts called by a master script?

I want to list all scripts (recursively) which are being called by a master script. For example: master.sh a.sh >> this script calls a1.sh, a2.sh, a3.sh etc b.sh >> this one calls b1.sh, ...
0
votes
3answers
903 views

What does -p do on shell script?

Does on -p [val] from shell start a process at a specific priority?
0
votes
1answer
704 views

why .profile under home directory does not work when log in

I am a newbie to UNIX. I am using mac OS X 10.8. I created .profile under home directory. However, it does not work when login. I always have to force it to work using the command $ . ~/.profile. Can ...
3
votes
1answer
343 views

Filter interactive output (top)

How can I filter the output from a "self-updating" program such as top while keeping its functionality intact? For example, I want to highlight my user name in top's output. My idea is to use ...
8
votes
8answers
36k views

How to find out the top space-consuming directories or files?

My disk is running out of space: $ df -h Filesystem Size Used Avail Use% Mounted on ... /dev/sda7 803G 715G 48G 95% /home I'd like to go through the whole home directory and find ...
0
votes
1answer
175 views

How to return to shell prompt in xterm linux?

When I do this: [myuser@myserver ~]$ find . -type f -name "*Myfile* -name "*20130*" > It enters ">" mode, and I can't exit it. How do I retun to shell prompt?
1
vote
0answers
160 views

Windows cmd only uses Linux commands

I'm using Windows 7 and for some weeks I can't use Windows commands (e.g. taskkill) anymore but Linux commands (e.g. ls, kill, ps,...) instead. The problem seems to be that it is not using my PATH ...
2
votes
2answers
1k views

Converting bash to zsh: declare function and if statement

I have copied this code from somewhere and am trying to modify it for my needs. It was designed for bash but I am running it under zsh. I always have trouble running bash scripts under zsh, as there ...
0
votes
1answer
978 views

linux logrotate how to set rules for all log files in an directory(including files in sub-directory)

For example, I want to set rules for all files under /home/example_user/public/ and all logs are actually located in different sub-directories like this: /home/example_user/public/siteA/access.log, ...
0
votes
1answer
711 views

Sourcing bash_prompt (bash script) when running zsh (oh-my-zsh)

I have a theme that is written in bash (I think). However, I have decided to use zsh for my shell. More specifically, I'm using oh-my-zsh (a customised zsh I believe). The theme I want to use is ...
0
votes
1answer
136 views

Emacs always starts shell in home directory with Windows 7

Running GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) on Windows 7, the shell command (M-x shell) always creates a DOS box with the home directory. I've seen in other questions/answers that the ...
8
votes
1answer
558 views

Why are some (often long) commands garbled in bash & zsh?

Many times when I enter a long command in bash or zsh (these are the only two shells I am positive I have seen this in) the cursor warps to somewhere in the middle of the string I am entering, can ...