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.

1348 questions
44
votes
4 answers

How to list symbolic link chains?

Given this example: mkdir a ln -s a b ln -s b c ln -s c d If I execute: ls -l d It will show: d -> c Is there a way for ls or any other linux command to show d -> c -> b -> a instead?
Kalecser
  • 543
  • 1
  • 4
  • 5
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
  • 1
  • 4
  • 3
42
votes
4 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,175
  • 2
  • 10
  • 12
40
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,172
  • 10
  • 37
  • 33
40
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 -…
holms
  • 1,524
  • 7
  • 20
  • 37
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
  • 794
  • 3
  • 21
  • 37
38
votes
9 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,221
  • 2
  • 16
  • 22
38
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
  • 485
  • 1
  • 4
  • 6
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
  • 6
  • 20
  • 26
36
votes
16 answers

Can't run AWS CLI from CRON (credentials)

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 an…
binaryorganic
  • 6,021
  • 4
  • 18
  • 19
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?
John
  • 7,343
  • 23
  • 63
  • 87
32
votes
12 answers

How to pass alias through sudo

I have an alias that passes in some parameters to a tool that I use often. Sometimes I run as myself, sometimes under sudo. Unfortunately, of course, sudo doesn't recognise the alias. Does anyone have a hint on how to pass the alias through? In…
Tanktalus
  • 461
  • 1
  • 4
  • 11
32
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.
Stephen Watkins
  • 539
  • 2
  • 5
  • 11
32
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
  • 371
  • 1
  • 4
  • 16
31
votes
8 answers

Why does it take tens of seconds to get a shell prompt?

It's a sort of regular occurrence that, after SSHing to a server (or even opening a terminal on my Mac), the login banner prints immediately but it takes ~10 seconds to a minute for the shell prompt to appear. After that, performance is fine and…
jacobbaer
  • 473
  • 1
  • 4
  • 5
1 2
3
89 90