Skip to content

Mysql commands

Moved Linux Systems Guides
  • Below when you see # it means from the unix shell. When you see mysql> it means from a MySQL prompt after logging into MySQL.

    To login (from unix shell) use -h only if needed.

    [mysql dir]/bin/mysql -h hostname -u root -p

    Create a database on the sql server.

    mysql> create database [databasename];

    List all databases on the sql server.

    mysql> show databases;

    Switch to a database.

    mysql> use [db name];

    To see all the tables in the db.

    mysql> show tables;

    To see database’s field formats.

    mysql> describe [table name];

    To delete a db.

    mysql> drop database [database name];

    To delete a table.

    mysql> drop table [table name];

    Show all data in a table.

    mysql> SELECT * FROM [table name];

    Returns the columns and column information pertaining to the designated table.

    mysql> show columns from [table name];

    Show certain selected rows with the value “whatever”.

    mysql> SELECT * FROM [table name] WHERE [field name] = "whatever";

    Show all records containing the name “Bob” AND the phone number ‘3444444’.

    mysql> SELECT * FROM [table name] WHERE name = “Bob” AND phone_number = ‘3444444’;

    Show all records not containing the name “Bob” AND the phone number ‘3444444’ order by the phone_number field.

    mysql> SELECT * FROM [table name] WHERE name != “Bob” AND phone_number = ‘3444444’ order by phone_number;

    Show all records starting with the letters ‘bob’ AND the phone number ‘3444444’.

    mysql> SELECT * FROM [table name] WHERE name like “Bob%” AND phone_number = ‘3444444’;

    Show all records starting with the letters ‘bob’ AND the phone number ‘3444444’ limit to records 1 through 5.

    mysql> SELECT * FROM [table name] WHERE name like “Bob%” AND phone_number = ‘3444444’ limit 1,5;

    Use a regular expression to find records. Use “REGEXP BINARY” to force case-sensitivity. This finds any record beginning with a.

    mysql> SELECT * FROM [table name] WHERE rec RLIKE “^a”;

    Show unique records.

    mysql> SELECT DISTINCT [column name] FROM [table name];

    Show selected records sorted in an ascending (asc) or descending (desc).

    mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;

    Return number of rows.

    mysql> SELECT COUNT(*) FROM [table name];

    Sum column.

    mysql> SELECT SUM(*) FROM [table name];

    Join tables on common columns.

    mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;

    Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs.

    # mysql -u root -p
    mysql> use mysql;
    mysql> INSERT INTO user (Host,User,Password) VALUES(‘%’,‘username’,PASSWORD(‘password’));
    mysql> flush privileges;

    Change a users password from unix shell.

    # [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password ‘new-password’

    Change a users password from MySQL prompt. Login as root. Set the password. Update privs.

    # mysql -u root -p
    mysql> SET PASSWORD FOR ‘user’@‘hostnaDISCLAIMER: All statements posted here are In my opinion ,not investment advice to buy or sell. Do your own DD me’ = PASSWORD(‘passwordhere’);
    mysql> flush privileges;

    Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables.

    Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server.

    # /etc/init.d/mysql stop
    # mysqld_safe --skip-grant-tables &
    # mysql -u root
    mysql> use mysql;
    mysql> update user set password=PASSWORD(“newrootpassword”) where User=‘root’;
    mysql> flush privileges;
    mysql> quit
    # /etc/init.d/mysql stop
    # /etc/init.d/mysql start

    Set a root password if there is on root password.

    # mysqladmin -u root password newpassword

    Update a root password.

    # mysqladmin -u root -p oldpassword newpassword

    Allow the user “bob” to connect to the server from localhost using the password “passwd”.

    Login as root. Switch to the MySQL db. Give privs. Update privs.

    # mysql -u root -p
    mysql> use mysql;
    mysql> grant usage on *.* to bob@localhost identified by ‘passwd’;
    mysql> flush privileges;

    Give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs.

    # mysql -u root -p
    mysql> use mysql;
    mysql> INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES (‘%’,‘databasename’,‘username’,‘Y’,‘Y’,‘Y’,‘Y’,‘Y’,‘N’);
    mysql> flush privileges;

    or

    mysql> grant all privileges on databasename.* to username@localhost;
    mysql> flush privileges;

    To update info already in a table.

    mysql> UPDATE [table name] SET Select_priv = ‘Y’,Insert_priv = ‘Y’,Update_priv = ‘Y’ where [field name] = ‘user’;

    Delete a row(s) from a table.

    mysql> DELETE from [table name] where [field name] = ‘whatever’;

    Update database permissions/privilages.

    mysql> flush privileges;

    Delete a column.

    mysql> alter table [table name] drop column [column name];

    Add a new column to db.

    mysql> alter table [table name] add column [new column name] varchar (20);

    Change column name.

    mysql> alter table [table name] change [old column name] [new column name] varchar (50);

    Make a unique column so you get no dupes.

    mysql> alter table [table name] add unique ([column name]);

    Make a column bigger.

    mysql> alter table [table name] modify [column name] VARCHAR(3);

    Delete unique from table.

    mysql> alter table [table name] drop index [colmn name];

    Load a CSV file into a table.

    mysql> LOAD DATA INFILE ‘/tmp/filename.csv’ replace INTO TABLE [table name] FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’ (field1,field2,field3);

    Dump all databases for backup. Backup file is sql commands to recreate all db’s.

    # [mysql dir]/bin/mysqldump -u root -ppassword --opt >/tmp/alldatabases.sql

    Dump one database for backup.

    # [mysql dir]/bin/mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql

    Dump a table from a database.

    # [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

    Restore database (or database table) from backup.

    # [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

    Create Table Example 1.

    mysql> CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));

    Create Table Example 2.

    mysql> create table [table name] (personid int(50) not null auto_increment primary key,firstname varchar(35),middlename varchar(50),lastnamevarchar(50) default ‘bato’);

    MYSQL Statements and clauses

    ALTER DATABASE
    
    ALTER TABLE
    
    ALTER VIEW
    
    ANALYZE TABLE
    
    BACKUP TABLE
    
    CACHE INDEX
    
    CHANGE MASTER TO
    
    CHECK TABLE
    
    CHECKSUM TABLE
    
    COMMIT
    
    CREATE DATABASE
    
    CREATE INDEX
    
    CREATE TABLE
    
    CREATE VIEW
    
    DELETE
    
    DESCRIBE
    
    DO
    
    DROP DATABASE
    
    DROP INDEX
    
    DROP TABLE
    
    DROP USER
    
    DROP VIEW
    
    EXPLAIN
    
    FLUSH
    
    GRANT
    
    HANDLER
    
    INSERT
    
    JOIN
    
    KILL
    
    LOAD DATA FROM MASTER
    
    LOAD DATA INFILE
    
    LOAD INDEX INTO CACHE
    
    LOAD TABLE...FROM MASTER
    
    LOCK TABLES
    
    OPTIMIZE TABLE
    
    PURGE MASTER LOGS
    
    RENAME TABLE
    
    REPAIR TABLE
    
    REPLACE
    
    RESET
    
    RESET MASTER
    
    RESET SLAVE
    
    RESTORE TABLE
    
    REVOKE
    
    ROLLBACK
    
    ROLLBACK TO SAVEPOINT
    
    SAVEPOINT
    
    SELECT
    
    SET
    
    SET PASSWORD
    
    SET SQL_LOG_BIN
    
    SET TRANSACTION
    
    SHOW BINLOG EVENTS
    
    SHOW CHARACTER SET
    
    SHOW COLLATION
    
    SHOW COLUMNS
    
    SHOW CREATE DATABASE
    
    SHOW CREATE TABLE
    
    SHOW CREATE VIEW
    
    SHOW DATABASES
    
    SHOW ENGINES
    
    SHOW ERRORS
    
    SHOW GRANTS
    
    SHOW INDEX
    
    SHOW INNODB STATUS
    
    SHOW LOGS
    
    SHOW MASTER LOGS
    
    SHOW MASTER STATUS
    
    SHOW PRIVILEGES
    
    SHOW PROCESSLIST
    
    SHOW SLAVE HOSTS
    
    SHOW SLAVE STATUS
    
    SHOW STATUS
    
    SHOW TABLE STATUS
    
    SHOW TABLES
    
    SHOW VARIABLES
    
    SHOW WARNINGS
    
    START SLAVE
    
    START TRANSACTION
    
    STOP SLAVE
    
    TRUNCATE TABLE
    
    UNION
    
    UNLOCK TABLES
    
    USE
    

    String Functions

    AES_DECRYPT
    
    AES_ENCRYPT
    
    ASCII
    
    BIN
    
    BINARY
    
    BIT_LENGTH
    
    CHAR
    
    CHAR_LENGTH
    
    CHARACTER_LENGTH
    
    COMPRESS
    
    CONCAT
    
    CONCAT_WS
    
    CONV
    
    DECODE
    
    DES_DECRYPT
    
    DES_ENCRYPT
    
    ELT
    
    ENCODE
    
    ENCRYPT
    
    EXPORT_SET
    
    FIELD
    
    FIND_IN_SET
    
    HEX
    
    INET_ATON
    
    INET_NTOA
    
    INSERT
    
    INSTR
    
    LCASE
    
    LEFT
    
    LENGTH
    
    LOAD_FILE
    
    LOCATE
    
    LOWER
    
    LPAD
    
    LTRIM
    
    MAKE_SET
    
    MATCH    AGAINST
    
    MD5
    
    MID
    
    OCT
    
    OCTET_LENGTH
    
    OLD_PASSWORD
    
    ORD
    
    PASSWORD
    
    POSITION
    
    QUOTE
    
    REPEAT
    
    REPLACE
    
    REVERSE
    
    RIGHT
    
    RPAD
    
    RTRIM
    
    SHA
    
    SHA1
    
    SOUNDEX
    
    SPACE
    
    STRCMP
    
    SUBSTRING
    
    SUBSTRING_INDEX
    
    TRIM
    
    UCASE
    
    UNCOMPRESS
    
    UNCOMPRESSED_LENGTH
    
    UNHEX
    
    UPPER
    

    Date and Time Functions

    ADDDATE
    
    ADDTIME
    
    CONVERT_TZ
    
    CURDATE
    
    CURRENT_DATE
    
    CURRENT_TIME
    
    CURRENT_TIMESTAMP
    
    CURTIME
    
    DATE
    
    DATE_ADD
    
    DATE_FORMAT
    
    DATE_SUB
    
    DATEDIFF
    
    DAY
    
    DAYNAME
    
    DAYOFMONTH
    
    DAYOFWEEK
    
    DAYOFYEAR
    
    EXTRACT
    
    FROM_DAYS
    
    FROM_UNIXTIME
    
    GET_FORMAT
    
    HOUR
    
    LAST_DAY
    
    LOCALTIME
    
    LOCALTIMESTAMP
    
    MAKEDATE
    
    MAKETIME
    
    MICROSECOND
    
    MINUTE
    
    MONTH
    
    MONTHNAME
    
    NOW
    
    PERIOD_ADD
    
    PERIOD_DIFF
    
    QUARTER
    
    SEC_TO_TIME
    
    SECOND
    
    STR_TO_DATE
    
    SUBDATE
    
    SUBTIME
    
    SYSDATE
    
    TIME
    
    TIMEDIFF
    
    TIMESTAMP
    
    TIMESTAMPDIFF
    
    TIMESTAMPADD
    
    TIME_FORMAT
    
    TIME_TO_SEC
    
    TO_DAYS
    
    UNIX_TIMESTAMP
    
    UTC_DATE
    
    UTC_TIME
    
    UTC_TIMESTAMP
    
    WEEK
    
    WEEKDAY
    
    WEEKOFYEAR
    
    YEAR
    
    YEARWEEK
    

    Mathematical and Aggregate Functions

    ABS
    
    ACOS
    
    ASIN
    
    ATAN
    
    ATAN2
    
    AVG
    
    BIT_AND
    
    BIT_OR
    
    BIT_XOR
    
    CEIL
    
    CEILING
    
    COS
    
    COT
    
    COUNT
    
    CRC32
    
    DEGREES
    
    EXP
    
    FLOOR
    
    FORMAT
    
    GREATEST
    
    GROUP_CONCAT
    
    LEAST
    
    LN
    
    LOG
    
    LOG2
    
    LOG10
    
    MAX
    
    MIN
    
    MOD
    
    PI
    
    POW
    
    POWER
    
    RADIANS
    
    RAND
    
    ROUND
    
    SIGN
    
    SIN
    
    SQRT
    
    STD
    
    STDDEV
    
    SUM
    
    TAN
    
    TRUNCATE
    
    VARIANCE
    

    Flow Control Functions

    CASE
    
    IF
    
    IFNULL
    
    NULLIF
    

    Command-Line Utilities

    comp_err
    
    isamchk
    
    make_binary_distribution
    
    msql2mysql
    
    my_print_defaults
    
    myisamchk
    
    myisamlog
    
    myisampack
    
    mysqlaccess
    
    mysqladmin
    
    mysqlbinlog
    
    mysqlbug
    
    mysqlcheck
    
    mysqldump
    
    mysqldumpslow
    
    mysqlhotcopy
    
    mysqlimport
    
    mysqlshow
    
    perror
    

    Perl API - using functions and methods built into the Perl DBI with MySQL

    available_drivers
    
    begin_work
    
    bind_col
    
    bind_columns
    
    bind_param
    
    bind_param_array
    
    bind_param_inout
    
    can
    
    clone
    
    column_info
    
    commit
    
    connect
    
    connect_cached
    
    data_sources
    
    disconnect
    
    do
    
    dump_results
    
    err
    
    errstr
    
    execute
    
    execute_array
    
    execute_for_fetch
    
    fetch
    
    fetchall_arrayref
    
    fetchall_hashref
    
    fetchrow_array
    
    fetchrow_arrayref
    
    fetchrow_hashref
    
    finish
    
    foreign_key_info
    
    func
    
    get_info
    
    installed_versions
    
    
    last_insert_id
    
    looks_like_number
    
    neat
    
    neat_list
    
    parse_dsn
    
    parse_trace_flag
    
    parse_trace_flags
    
    ping
    
    prepare
    
    prepare_cached
    
    primary_key
    
    primary_key_info
    
    quote
    
    quote_identifier
    
    rollback
    
    rows
    
    selectall_arrayref
    
    selectall_hashref
    
    selectcol_arrayref
    
    selectrow_array
    
    selectrow_arrayref
    
    selectrow_hashref
    
    set_err
    
    state
    
    table_info
    
    table_info_all
    
    tables
    
    trace
    
    trace_msg
    
    type_info
    
    type_info_all
    
    Attributes for Handles
    

    PHP API - using functions built into PHP with MySQL

    mysql_affected_rows
    
    mysql_change_user
    
    mysql_client_encoding
    
    mysql_close
    
    mysql_connect
    
    mysql_create_db
    
    mysql_data_seek
    
    mysql_db_name
    
    mysql_db_query
    
    mysql_drop_db
    
    mysql_errno
    
    mysql_error
    
    mysql_escape_string
    
    mysql_fetch_array
    
    mysql_fetch_assoc
    
    mysql_fetch_field
    
    mysql_fetch_lengths
    
    mysql_fetch_object
    
    mysql_fetch_row
    
    mysql_field_flags
    
    mysql_field_len
    
    mysql_field_name
    
    mysql_field_seek
    
    mysql_field_table
    
    mysql_field_type
    
    mysql_free_result
    
    mysql_get_client_info
    
    mysql_get_host_info
    
    mysql_get_proto_info
    
    mysql_get_server_info
    
    mysql_info
    
    mysql_insert_id
    
    mysql_list_dbs
    
    mysql_list_fields
    
    mysql_list_processes
    
    mysql_list_tables
    
    mysql_num_fields
    
    mysql_num_rows
    
    mysql_pconnect
    
    mysql_ping
    
    mysql_query
    
    mysql_real_escape_string
    
    mysql_result
    
    mysql_select_db
    
    mysql_stat
    
    mysql_tablename
    
    mysql_thread_id
    
    mysql_unbuffered_query
    
  • rickR rick moved this topic from File assistance | Discussion on

FreeBSD Notes
  • Unable to negotiate with 10.10.1.35 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

    While attempting ssh this error is generally due to mismatched versions of ssh, where an up to date version is attempting to access an older version

    Add the following to your command :

    The proper way:

    ssh -o KexAlgorithms=diffie-hellman-group14-sha1 -oHostKeyAlgorithms=+ssh-dss 10.10.1.35

    The cheap way:

    Example :

    ssh -oHostKeyAlgorithms=+ssh-dss 10.10.1.35

    or ssh -oHostKeyAlgorithms=+ssh-dss user@10.10.1.35

    This can be added to the ~/.ssh/config file

    Host my-server HostName 10.10.1.35 HostKeyAlgorithms=+ssh-dss
    read more

  • Locate hard drive and get information

    ls -l /sys/block | grep sd.

    Output:

    lrwxrwxrwx 1 root root 0 Jun 22 06:28 sda -> ../devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda lrwxrwxrwx 1 root root 0 Jun 22 06:28 sdb -> ../devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0/block/sdb lrwxrwxrwx 1 root root 0 Jun 22 06:28 sdc -> ../devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/block/sdc lrwxrwxrwx 1 root root 0 Jun 22 06:28 sdd -> ../devices/pci0000:00/0000:00:1f.2/ata4/host3/target3:0:0/3:0:0:0/block/sdd

    Or for a more detailed view

    strace -e trace=open lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 3.6T 0 disk ├─data--2-data--2_tmeta 252:3 0 15.9G 0 lvm │ └─data--2-data--2-tpool 252:9 0 3.6T 0 lvm │ ├─data--2-data--2 252:10 0 3.6T 1 lvm │ ├─data--2-vm--101--disk--0 252:11 0 8G 0 lvm │ ├─data--2-vm--103--disk--0 252:12 0 32G 0 lvm │ ├─data--2-vm--107--disk--0 252:13 0 500G 0 lvm │ └─data--2-vm--108--disk--0 252:20 0 100G 0 lvm └─data--2-data--2_tdata 252:6 0 3.6T 0 lvm └─data--2-data--2-tpool 252:9 0 3.6T 0 lvm ├─data--2-data--2 252:10 0 3.6T 1 lvm ├─data--2-vm--101--disk--0 252:11 0 8G 0 lvm ├─data--2-vm--103--disk--0 252:12 0 32G 0 lvm ├─data--2-vm--107--disk--0 252:13 0 500G 0 lvm └─data--2-vm--108--disk--0 252:20 0 100G 0 lvm sdb 8:16 0 698.6G 0 disk └─sdb1 8:17 0 698.6G 0 part /mnt/pve/backups sdc 8:32 0 3.6T 0 disk ├─vm--data-vm--data_tmeta 252:4 0 15.9G 0 lvm │ └─vm--data-vm--data-tpool 252:14 0 3.6T 0 lvm │ ├─vm--data-vm--data 252:15 0 3.6T 1 lvm │ ├─vm--data-vm--100--disk--0 252:16 0 270G 0 lvm │ ├─vm--data-vm--102--disk--0 252:17 0 100G 0 lvm │ ├─vm--data-vm--104--disk--0 252:18 0 25G 0 lvm │ └─vm--data-vm--106--disk--0 252:19 0 32G 0 lvm └─vm--data-vm--data_tdata 252:7 0 3.6T 0 lvm └─vm--data-vm--data-tpool 252:14 0 3.6T 0 lvm ├─vm--data-vm--data 252:15 0 3.6T 1 lvm ├─vm--data-vm--100--disk--0 252:16 0 270G 0 lvm ├─vm--data-vm--102--disk--0 252:17 0 100G 0 lvm ├─vm--data-vm--104--disk--0 252:18 0 25G 0 lvm └─vm--data-vm--106--disk--0 252:19 0 32G 0 lvm sdd 8:48 0 931.5G 0 disk ├─sdd1 8:49 0 1007K 0 part ├─sdd2 8:50 0 1G 0 part └─sdd3 8:51 0 930.5G 0 part ├─pve-swap 252:0 0 8G 0 lvm [SWAP] ├─pve-root 252:1 0 96G 0 lvm / ├─pve-data_tmeta 252:2 0 8.1G 0 lvm │ └─pve-data 252:8 0 794.3G 0 lvm └─pve-data_tdata 252:5 0 794.3G 0 lvm └─pve-data 252:8 0 794.3G 0 lvm +++ exited with 0 +++ cat /proc/partitions major minor #blocks name 8 0 3907018584 sda 8 16 732574584 sdb 8 17 732572672 sdb1 8 32 3907018584 sdc 8 48 976762584 sdd 8 49 1007 sdd1 8 50 1048576 sdd2 8 51 975712967 sdd3 252 0 8388608 dm-0 252 1 100663296 dm-1 252 2 8495104 dm-2 252 3 16650240 dm-3 252 4 16650240 dm-4 252 6 3873329152 dm-6 252 5 832888832 dm-5 252 7 3873329152 dm-7 252 8 832888832 dm-8 252 9 3873329152 dm-9 252 10 3873329152 dm-10 252 11 8388608 dm-11 252 12 33554432 dm-12 252 13 524288000 dm-13 252 14 3873329152 dm-14 252 15 3873329152 dm-15 252 16 283115520 dm-16 252 17 104857600 dm-17 252 18 26214400 dm-18 252 19 33554432 dm-19 252 20 104857600 dm-20

    Locate drive by serial and model information

    hdparm -i /dev/sda /dev/sda: Model=WDC WD4000FYYZ-05UL1B0, FwRev=00.0NS05, SerialNo=WD-WCC132262513 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=off CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=7814037168 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120} PIO modes: pio0 pio3 pio4 DMA modes: mdma0 mdma1 mdma2 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 AdvancedPM=yes: unknown setting WriteCache=disabled Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7 * signifies the current active mode
    read more

  • Screen recording can use webm as their format, it can be more simple to use a gif to embed into a website or forum, than adding scripts to host different video format.

    In this case I grabbed a screen record of the progress for writing zeros to a hard drive with dd

    Use ffmpeg to convert webm to gif:

    First create a pallet:

    Move into the directory which the webm is located, or type in the path

    Where ‘dd.webm’ is the screen recording

    ffmpeg -y -i dd.webm -vf palettegen palette.png

    Output:

    dd-ffmpeg.png

    Then convert the webm to gif:

    ffmpeg -y -i dd.webm -i palette.png -filter_complex paletteuse -r 10 dd.gif

    dd-webm-2.png

    This is what I ended up with, looks like any image of any alien on the interwebz, as if shot through a potato, some tweaking of the command is in my future. None the less.

    dd.gif

    read more

  • Write zeros to all sectors

    Use the command ‘lsblk’ to find the drive you wish to erase

    I’m using ‘dd’ to erase things

    In this case I’m torching sdb

    Only use status=progress if you care it’s not necessary

    dd if=/dev/zero of=/dev/sdb bs=12M status=progress

    dd.gif

    read more

  • Remove old kernel images that are cluttering the system

    zstd-no-space-error.png

    Most of these errors are due to low or not enough space left in the root partition.

    If you are using a Debian flavor:

    sudo apt-get autoremove --purge

    zstd-error.png

    Inform grub whenever an old kernel is removed:

    update-grub

    update-grub.png

    Remove the un-used kernel config files:

    These will be the files pre cursed as ‘rc’ where installed kernels use ‘ii’

    … As well as files no longer used or required due to dependencies

    This command will detect, print, and remove left over cruft from previously installed packages or scripts, that have been removed or updated.

    sudo dpkg --purge $(dpkg -l | awk '/^rc/{print $2}')

    purge.png

    You can re-run the following to view the installed kernel(s):

    dpkg --list | grep linux-image

    installed-kernels.png

    read more