Questions tagged [shell]

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

Shells are used to interact with the Operating System (OS) and launch other applications.

Shells also have built-in commands, depending on the OS. Examples are directory listings, moving and copying files (Windows) or job control (Unix-like).

Most shells offer scripting capabilities, starting with simple sequential execution of commands. For more complex problems, control structures (like conditionals or loops) can be used.

Broadly used shell include:

  1. Windows:
  2. Unix-like:
    • Bourne Shell
    • Bourne Again Shell
    • Korn Shell
    • (Tenex) C Shell /
    • Z Shell
    • Friendly Interactive Shell

See Comparison of command shells on Wikipedia for a more extensive list.

4058 questions
24
votes
4 answers

What's the usage of -exec xargs and -print0?

I think these are the common ways of passing the result of one command to the next one, as inputs. How do these three work? Or what are some websites/URLs?
23
votes
2 answers

how to delete all characters after cursor in shell

I want to delete all characters after cursor in putty or shell. How can i achieve this? Every time I want to delete the complete line, I need to press delete key and that is something I don't want to do. Finding a way to delete the line improve my…
20
votes
5 answers

Keeping my zsh or bash profile synced up on all my machines

I work on several different machines. I have a lot of specific things I like my shell to, or the prompt to look like, or aliases, etc. What do you think the best way to keep all my machines shells to act the same? First off, I'm aware that different…
19
votes
2 answers

Why is 1>a.txt 2>&1 different from 1>a.txt 2>a.txt ? (Example shown)

EDIT Please see not only the accepted answer but also the other one(s). Question Why does redirecting both STDOUT and STDERR to the same file not work, although it looks like the same as 1>[FILENAME] 2>&1 ? Here is an example: perl -e 'print "1\n" ;…
akai
  • 309
10
votes
1 answer

shell: "can't shift that many" error

The following script works fine in one of my machines, printing 1 then 2: #!/bin/sh echo "1" shift echo "2" On another machine, however, it produces the following output: 1 ./script.sh: 4: shift: can't shift that many man shift does not help (No…
anol
  • 1,741
9
votes
3 answers

How can I disable the CTRL-ALT-DEL key combination completely on XP/Vista/7?

I have been googling extensively to figure this out, and nobody seems to be able to give a direct answer. Let me start by saying that I'm NOT talking about requiring CTRL-ALT-DEL to enter logon information. I'm working on a golf simulator program…
Travesty3
  • 553
  • 3
  • 6
  • 15
8
votes
2 answers

How do I configure fzf to return only a specific field of the selected line?

I recently ran into fzf, which seems like a fantastic little tool, but there's one thing I'm having trouble with: given input with multiple fields per line, how do I configure it to return only a particular field when pressing enter? The accept…
larsks
  • 4,212
7
votes
2 answers

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?
Jichao
  • 7,470
4
votes
2 answers

how to pass password to sudo commands?

on OSX I do sudo route delete default sudo route add default 192.168.178.1 to change my default gateway. On running a sh file with these I am asked for a password every time. Which I run as sh changegw.sh. How do I pass my password before hand?
epsilon8
  • 730
  • 3
  • 12
  • 22
3
votes
1 answer

How do I get the delete key to work properly

I'm on a linux box: jla@jaspden-desktop$ uname -a Linux jaspden-desktop 2.6.35.13-92.fc14.i686 #1 SMP Sat May 21 17:39:42 UTC 2011 i686 i686 i386 GNU/Linux here, at the command prompt, the backspace key deletes the character behind the cursor,…
3
votes
2 answers

Count the occurences of a list of words in files

I have a list of words like this, separated by line: Range Balance Total CombinList CombinRow GridKey KeDanJia AddRowNum TopList Keysearch Keysearchtaobao IsearchData IsearchDataSep ... And I have some files under a directory: $ tree . |--…
fool
  • 133
3
votes
3 answers

Which shell to use to modify/replace Windows Explorer (don’t want fancy desktop but better browsing of folders/files... similar to Classic Shell)

I do know about the existence of alternative shells such as SharpE, Emerge Desktop, Ashton Shell, BB4Win, etc... I've looked into a few of those popular/famous ones, but they all seem to be very desktop-centric. That is, they transform how your…
3
votes
1 answer

Get find output to delete files later

I would like to take the results from this command: find . -type f -size +200M -exec ls -lh {} \; store the content to a variable of some form, and then delete the found files. How can I do this?
Dave
  • 31
2
votes
4 answers

How to moves files two directories up using ssh?

I am able to move files one directory up by using the following command: mv * .. but is there a way to move files two directories up?
Amy
2
votes
2 answers

Why is the exec command used for file descriptor redirection?

In UNIX shells like Bash and Korn shell exec is used for two specific uses. Its use to replace the current program with another, as in exec prog is understandable. The name exec is a contraction from the C family of routines based on execve. If I…
cdarke
  • 123
  • 3
1
2 3 4 5