• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Search

shell

Linux Useradd

June 16, 2020

Here’s the command to add a Linux user.

useradd -m -s $(which bash) -G sudo ulysses

useradd -m -s $(which bash) -G sudo ulysses

-m creates a home directory. -s selects a shell. -G adds user to a sudo group.

Filed Under: Linux Tagged With: group, home directory, shell, useradd

GCloud Interactive Shell

September 21, 2019

If you already have Google SDK installed, you can activate GCloud Interactive Shell, which is still in beta by the way, by typing the following command from the Google SDK terminal.

gcloud beta interactive

gcloud beta interactive

The interactive shell environment has auto-completion. It shows you who’s logged in and which project you are currently set in. To exit the interactive shell, just Press F9 to quit.

Filed Under: Cloud Tagged With: activate, beta, gcloud, gcp, google, interactive, sdk, shell

Run Shell Script From Your Website

September 10, 2019

Here’s how to run a shell script from your website. You’ll need 2 files.

Here’s the contents of foo.php. Wrap your output with ‘pre’ for better formatting.

<?php
$output = shell_exec('/var/www/html/bar.sh 2>&1');
echo "$output";

<?php $output = shell_exec('/var/www/html/bar.sh 2>&1'); echo "$output";

Here’s the content of bar.sh. Output will be displayed on web page.

#!/bin/bash
now="$(date +'%y%m%d')"
echo $now
aws s3 ls

#!/bin/bash now="$(date +'%y%m%d')" echo $now aws s3 ls

Filed Under: Cloud, Linux Tagged With: bash, php, run, script, shell, website

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to Next Page »
  • Home
  • About
  • Search

Copyright © 2023