• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

command line

Editors on Terminal

August 25, 2022

How to run editors from the Terminal.

Sublime, Visual Studio Code, Atom and Bluefish examples.

Open from the current directory.

subl .
code .
atom .
bluefish .

subl . code . atom . bluefish .

Open editor using path and file.

subl /etc/hosts
code /etc/hosts
atom /etc/hosts
bluefish /etc/hosts

subl /etc/hosts code /etc/hosts atom /etc/hosts bluefish /etc/hosts

Filed Under: Linux Tagged With: atom, bluefish, command line, editors, sublime, terminal, visual studio

Linux Format USB Drive

July 9, 2020

Here’s how to format a USB drive on Linux.

Plug in the USB drive to see mount point.

# scan for all drives
df -Th
Filesystem     Type     Size  Used Avail Use% Mounted on
/dev/sdc1      fuseblk   30G   66M   30G   1% /media/ulysses/451B99AF225B48EC

# scan for all drives df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/sdc1 fuseblk 30G 66M 30G 1% /media/ulysses/451B99AF225B48EC

Unmount USB drive.

umount /dev/sdc1

umount /dev/sdc1

Choose a file system type and run the appropriate format command.

# nfts format
mkfs.ntfs /dev/sdc1
# vfat format
mkfs.vfat /dev/sdc1
# ext4 format
mkfs.ext4 /dev/sdc1

# nfts format mkfs.ntfs /dev/sdc1 # vfat format mkfs.vfat /dev/sdc1 # ext4 format mkfs.ext4 /dev/sdc1

Filed Under: Linux Tagged With: 3.0, command line, format, mount, terminal, usb

Printing From A Terminal

July 7, 2020

There are times you just want to print directly from the command line.

# check your printing options
lpotions
lpinfo -v
# what's your default printer
lpinfo -p -d
# use lp to print
lp notes.txt
# use -n print multiple copies
lp -n 2 notes.txt
# check the printer queue
lp -q
# use the job number to cancel print jobs if needed
cancel 123

# check your printing options lpotions lpinfo -v # what's your default printer lpinfo -p -d # use lp to print lp notes.txt # use -n print multiple copies lp -n 2 notes.txt # check the printer queue lp -q # use the job number to cancel print jobs if needed cancel 123

Filed Under: Linux Tagged With: cancel, command line, cups, linux, print, queue

Linux Mint 20 Ulyana

July 6, 2020

I upgraded my desktop to Linux Mint 20 Ulyana over the weekend.

Edit your package repository. Replace tricia with ulyana, and bionic with focal.

vim /etc/apt/sources.list.d/official-package-repositories.list

vim /etc/apt/sources.list.d/official-package-repositories.list

Run update first.

apt update -y
apt upgrade -y

apt update -y apt upgrade -y

Perform upgrade to Linux Mint 20. When prompted, choose default.

apt dist-upgrade

apt dist-upgrade

Reboot.

reboot

reboot

cat /etc/os-release.

ulysses@penguin:~/Code$ cat /etc/os-release
NAME="Linux Mint"
VERSION="20 (Ulyana)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 20"
VERSION_ID="20"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.ubuntu.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=ulyana
UBUNTU_CODENAME=focal

ulysses@penguin:~/Code$ cat /etc/os-release NAME="Linux Mint" VERSION="20 (Ulyana)" ID=linuxmint ID_LIKE=ubuntu PRETTY_NAME="Linux Mint 20" VERSION_ID="20" HOME_URL="https://www.linuxmint.com/" SUPPORT_URL="https://forums.ubuntu.com/" BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/" PRIVACY_POLICY_URL="https://www.linuxmint.com/" VERSION_CODENAME=ulyana UBUNTU_CODENAME=focal

Filed Under: Linux Tagged With: command line, linux mint, linux mint 20, ulyana, upgrade

SFTP Login

July 8, 2019

How to login using SFTP on a non-standard port.

sftp -oPort=2233 username@servername

sftp -oPort=2233 username@servername

Get list of commands.

sftp help

sftp help

Filed Under: Linux Tagged With: authentication, cli, command line, different, login, port, sftp

WP-CLI

September 14, 2016

WP-CLI is a set of command-line tools for managing WordPress websites. With just a few simple commands, you can manage WordPress from the command line without the need to login to the Admin Dashboard and navigate the pages. You can install, update and delete plugins and themes, perform backups, configure standard and multisite installs and much more — all without ever using a web browser.

How to install WP-CLI

$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Make WP-CLI Executable

$ chmod +x wp-cli.phar

$ chmod +x wp-cli.phar

Rename wp-cli.phar to wp and move to a folder where it can be executed globally.

$ sudo mv wp-cli.phar /usr/local/bin/wp

$ sudo mv wp-cli.phar /usr/local/bin/wp

How to Install and Activate Theme from the command line

$ wp theme install twentytwelve
$ wp theme activate twentytwelve

$ wp theme install twentytwelve $ wp theme activate twentytwelve

How to Install, Activate, Deactivate a Plugin

$ wp plugin install hello-dolly
$ wp plugin activate hello-dolly
$ wp plugin deactivate hello-dolly

$ wp plugin install hello-dolly $ wp plugin activate hello-dolly $ wp plugin deactivate hello-dolly

How to update WordPress to the latest core release

$ wp core update

$ wp core update

How to list the last 5 posts

$ wp post list --post_type=post --posts_per_page=5 --format=json

$ wp post list --post_type=post --posts_per_page=5 --format=json

The command above will spit out an array in JSON format.

Read the rest of WP-CLI documentation.

Filed Under: WP Tagged With: command line, wp-cli

  • Home
  • About
  • Archives

Copyright © 2023