Questions tagged [shell]

A shell is terminology for a command-line interpreter most commonly used with Unix-like operating systems, but also used to interact with GUI-based operating systems in a more granular fashion.

Not only does it allows the user to run programs from a text interface, but frequently offers basic programming features such as variables, substitution, output redirection, and wildcards.

A shell is terminology for a command-line interpreter most commonly used with Unix-like operating systems, but also used to interact with GUI-based operating systems in a more granular fashion.

Not only does it allows the user to run programs from a text interface, but frequently offers basic programming features such as variables, substitution, output redirection, and wildcards.

The name was first used by Unix operating system for an interpreter used for command prompt, but currently the term shell refers to BASH(Bourne Again SHell) and other command prompt interpreters too.

1367 questions
47
votes
12 answers

How to find the gateway IP address in Linux

What command can you use to find the Gateway IP Address (ie. home router address) for eth0 in Linux? I need to get the IP address from a command line app to use in a shell script.
J. Polfer
  • 739
47
votes
5 answers

Faking the date for a specific shell session

I'm certainly trying to achieve something weird here, but I want to fake the date locally for a shell session on GNU/Linux. I need to black-box test how a program behaves at different dates, and modifying the system-wide date can have unwanted side…
nicoulaj
  • 1,285
46
votes
23 answers

Finding the Public IP address in a shell script

I can find my IP address using ifconfig or hostname -i command. But how do I find my Public IP? (I have a static public IP but I want to find it out using unix command)
shantanuo
  • 3,709
43
votes
2 answers

Run command as Linux "system" user (shell = /bin/false)

I created a "system" user in Ubuntu 11.04 ( adduser --system ) for running certain cron jobs, but sometimes I want to test things out by manually running commands as that user. What's the easiest way to do this? su doesn't work, because the user has…
EMP
  • 5,264
43
votes
6 answers

Shell command to see the HTTP headers

Is there a shell command to see the headers of a HTTP request? For example, I would like to know what the headers retrieved from www.example.com/test.php are How can I do this?
Damiano
  • 431
43
votes
6 answers

How to rename multiple files by replacing word in file name?

Replace ACDC to AC-DC For example we have these files ACDC - Rock N' Roll Ain't Noise Pollution.xxx ACDC - Rocker.xxx ACDC - Shoot To Thrill.xxx I want them to become: AC-DC - Rock N' Roll Ain't Noise Pollution.xxx AC-DC - Rocker.xxx AC-DC - Shoot…
holms
  • 1,714
  • 7
  • 22
  • 38
42
votes
10 answers

Need to fix file permissions in a user's home directory

Does anyone have a tool or script that will recursively correct the file permissions on a directory? On an Ubuntu Linux machine, a bunch of files were copied to a USB disk with full 777 permissions (user, group, other - read, write, execute) in…
mlambie
  • 1,251
40
votes
1 answer

Run command in detached tmux session

This is probably simple, but I really can't find out how you do it. I have read the man pages and googled without results. Problem: How do I run a command in a detached tmux window? Example: I want my detached window 'foo' to run 'ls', but I want to…
Accatyyc
  • 505
  • 1
  • 4
  • 6
39
votes
17 answers

Why can't I run AWS CLI command from CRON (credentials)?

I am trying to run a simple AWS CLI backup script. It loops through lines in an include file, backs those paths up to S3, and dumps output to a log file. When I run this command directly, it runs without any error. When I run it through CRON I get…
39
votes
14 answers

How can I display the IP address of an interface?

If I want to display the IP address that is assigned to eth1, how can I do this in Bash?
user47556
  • 609
  • 1
  • 6
  • 11
38
votes
3 answers

#!/bin/sh vs #!/bin/bash for maximum portability

I usually work with Ubuntu LTS servers which from what I understand symlink /bin/sh to /bin/dash . A lot of other distros though symlink /bin/sh to /bin/bash . From that I understand that if a script uses #!/bin/sh on top it may not run the same way…
cherouvim
  • 924
36
votes
8 answers

Is there any reason to use bash over zsh?

I'm curious about why one would want to run bash instead of zsh. I mean zsh is fully backwards-compatible with bash. Don't get me wrong: I don't dislike bash or anything. I just genuinely want to know if there are any advantages to using it over…
Jason Baker
  • 1,229
35
votes
4 answers

What is /bin/dash?

I thought /bin/sh was a symlink to my shell of choice. I've always used bash , so I assumed that /bin/sh would point to /bin/bash . It turns out, though, that it points to /bin/dash . It gets funnier. I start dash and do echo $SHELL and it prints…
aioobe
  • 401
34
votes
8 answers

How do I exclude directories when listing files?

How do I exclude directories when listing files in the current directory? ls . ^ will include directories in the listing.
34
votes
4 answers

Append an echo to file?

In linux, how do I do something like echo 'hello world' > log.txt but instead of overwriting the contents of log.txt, it appends to the end of of log.txt?
learningtech
  • 7,819
1 2
3
…
91 92