Bash

bash - man - ps

PS(1)                                                                                                           User Commands                                                                                                          PS(1)

NAME
       ps - report a snapshot of the current processes.

SYNOPSIS
       ps [options]

DESCRIPTION
       ps displays information about a selection of the active processes.  If you want a repetitive update of the selection and the displayed information, use top(1) instead.

       This version of ps accepts several kinds of options:

       1   UNIX options, which may be grouped and must be preceded by a dash.
       2   BSD options, which may be grouped and must not be used with a dash.
       3   GNU long options, which are preceded by two dashes.

Tags

youtube-dl: download shell script ( DRAF )

YouTube-DL Wrapper Shell Script

 

# ALL # SINGLE
youtube-dl -no-playlist --verbose -f bestvideo \
--write-thumbnail --write-description --write-info-json --no-overwrites --restrict-filenames \
--output '/home/uc/Videos/ytu/%(uploader)s/%(title)s.%(ext)s' \
https://www.youtube.com/watch?v=jfM6cOtqBHE

 

# Playlist
youtube-dl --yes-playlist --verbose -f bestvideo \
--write-thumbnail --write-description --write-info-json --no-overwrites --restrict-filenames \
--output '/home/uc/Videos/ytu/%(uploader)s/%(playlist)s/%(playlist_index)s-%(title)s.%(ext)s' \
https://www.youtube.com/watch?v=jfM6cOtqBHE

 

Linux: Resetting External Drive Permisions to Root for access issues ( ie: USB HDD )

USB devices will need to be treated as if ONLY the root user will access.. BECAUSE....

... if non-root user owns the files... NO ONE ELSE CAN ADMIN them

here's a bash script to both reclaim ownership, then reset permisions to 777

this script accepts 1 argument, or it will process



function pausing {
    read -p "Press ENTER to CONTINUE, CTRL-C to ABORT" paused
    line
}
function line {
    echo "---------------------------------------------------"
}
line
echo "update usb hdd file/folder permissions recursively"
echo "target: $1"
line
ls -la "$1"

echo "running chown -R root:root"
line
sudo chown -R root:root "$1"
echo "done.."

echo "running chmod -R 777"
line
sudo chmod -R 777 "$1"
echo "done.."

echo "done, listing target...."
ls -la "$1"
pausing

 

Tags

Linux: Apt Proxy Add/Remove

Source:https://stackoverflow.com/questions/38591415/ubuntu-16-04-apt-get-not-working-through-proxy

check /etc/apt/apt.conf

add/ remove Aquire::<protocol> as needed

  • /etc/apt/apt.conf
  • Acquire::http::proxy "http://[username]:[password]@[webproxy]:[port]/";
  • Acquire::https::proxy "https://[username]:[password]@[webproxy]:[port]/";
  • Acquire::ftp::proxy "ftp://[username]:[password]@[webproxy]:[port]/";
  • Acquire::socks::proxy "socks://[username]:[password]@[webproxy]:[port]/";

In Ubuntu 14.04, in order to use some commands in terminal (like apt-get) trough the company proxy, I need to do the following changes, beyond System Settings > Network > Network proxy > "Apply system wide" (shame on you, Ubuntu)

Tags

Linux: Ubuntu 18.04.3 Change hostname ( for SAMBA, etc )

https://linuxize.com/post/how-to-change-hostname-on-ubuntu-18-04/

hostnamectl

hostnamectl
bamboo

sudo hostnamectl set-hostname jira
hostnamectl
jira

hosts

sudo cp /etc/hosts /etc/hosts.bak
sudo nano /etc/hosts
127.0.1.1 bamboo

127.0.0.1 jira


EDIT cloud.cfg ( if cloud-init installed )

ls -l /etc/cloud/cloud.cfg

setup@bamboo:~$ ls -la /etc/cloud/cloud.cfg
-rw-r--r-- 1 root root 3612 May 11  2019 /etc/cloud/cloud.cfg


Search for preserve_hostname and change the value from false to true:

sudo nano /etc/cloud/cloud.cfg
# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: false

# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: true

Bash: date command

`date +"%y%m%d"`.tgz

$ echo `date +"%y%m%d"`.tgz
191125.tgz

$ echo `date +"%Y%m%d"`.tgz
20191125.tgz


$ date --help
Usage: date [OPTION]...
Tags
Subscribe to Bash