useful commands , anyone to add

Arch based Porteus community project
aus9

useful commands , anyone to add

Post#1 by aus9 » 14 Nov 2015, 11:37

Hi

Anyone can reply to add their favourite or important code snippets (normally a one or 2 lines of commands)

brokenman has already improved on my earlier code snippet

so lets start with how brokenman discovers a random user's modules directory

Code: Select all

echo $MODDIR

# and my result
/mnt/sda3/nemesis/modules
Now we know that works, we don't need to have a long pathway to deactivate or activate a module so this works as example, run as root

Code: Select all

activate $MODDIR/vlc (and press TAB key to autocomplete modulename)
to fix the bad Official XZ build for ca-certificates users must create and update their certs by root command

Code: Select all

update-ca-trust
Last edited by aus9 on 01 Dec 2015, 23:31, edited 5 times in total.

aus9

Re: code snippets, anyone to add

Post#2 by aus9 » 14 Nov 2015, 11:41

On first bootup of your nemesis I now do this, post editted due to reply by brokenman
viewtopic.php?f=137&t=5216#p38958

Done as root, either prefix commands with sudo, or run su -

Code: Select all

 setup-pman 
 pman -Sy
Now you can find packages by formula
pman -S packagename
eg

Code: Select all

pman -S inxi
resolving dependencies...
looking for conflicting packages...

Packages (1) inxi-2.2.28-1

Total Download Size:   0.12 MiB
Total Installed Size:  0.48 MiB

:: Proceed with installation? [Y/n]
Last edited by aus9 on 17 Nov 2015, 12:09, edited 3 times in total.

aus9

Re: code snippets, anyone to add

Post#3 by aus9 » 14 Nov 2015, 11:53

inxi has a bag full of switches, can be run as local user

Newbies not sure what their hardware is? then show the lot with

Code: Select all

inxi -F
Resuming in non X mode: xdpyinfo not found. For package install advice run: inxi --recommends
System:    Host: nemesis Kernel: 4.2.5-nemesis x86_64 (64 bit) Desktop: LXDE (Openbox 3.6.1) Distro: Arch Linux
Machine:   System: ASUS product: All Series
           Mobo: ASUSTeK model: Z97M-PLUS v: Rev X.0x serial: 140425246201515
           Bios: American Megatrends v: 2801 date: 04/08/2015
CPU:       Quad core Intel Core i5-4590 (-MCP-) cache: 6144 KB 
           clock speeds: max: 3700 MHz 1: 3300 MHz 2: 3300 MHz 3: 3300 MHz 4: 3300 MHz
Graphics:  Card: Intel Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller
           Display Server: X.org 1.17.3 drivers: intel (unloaded: fbdev,vesa)
           tty size: 138x39 Advanced Data: N/A for root
Audio:     Card-1 Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller driver: snd_hda_intel
           Card-2 Intel 9 Series Family HD Audio Controller driver: snd_hda_intel
           Sound: Advanced Linux Sound Architecture v: k4.2.5-nemesis
Network:   Card: Intel Ethernet Connection (2) I218-V driver: e1000e
           IF: eth0 state: up speed: 100 Mbps duplex: full mac: 10:c3:7b:92:4e:2e
Drives:    HDD Total Size: 1000.2GB (7.3% used) ID-1: /dev/sda model: WDC_WD10EZEX size: 1000.2GB
Partition: ID-1: swap-1 size: 53.69GB used: 0.00GB (0%) fs: swap dev: /dev/sda2
Sensors:   None detected - is lm-sensors installed and configured?
Info:      Processes: 125 Uptime: 30 min Memory: 509.6/7679.6MB Init: systemd Client: Shell (bash) inxi: 2.2.28

here is just the sound one

Code: Select all

inxi -A
Resuming in non X mode: xdpyinfo not found. For package install advice run: inxi --recommends
Audio:     Card-1 Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller driver: snd_hda_intel
           Card-2 Intel 9 Series Family HD Audio Controller driver: snd_hda_intel
           Sound: Advanced Linux Sound Architecture v: k4.2.5-nemesis
for help all switches

Code: Select all

inxi -h
Last edited by aus9 on 14 Nov 2015, 12:37, edited 1 time in total.

User avatar
brokenman
Site Admin
Site Admin
Posts: 5439
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: code snippets, anyone to add

Post#4 by brokenman » 14 Nov 2015, 12:01

Check the environment variables. In Nemesis I exported some, such as: echo $MODDIR
How do i become super user?
Wear your underpants on the outside and put on a cape.

aus9

Re: code snippets, anyone to add

Post#5 by aus9 » 14 Nov 2015, 12:07

brokenman, wil edit earlier reply to adjust thanks

debian commands still work for network

Code: Select all

ifconfig
If you only get an entry for loopback (lo) then you have more to do to get ethernet or wlan up.

run as root

Code: Select all

ifconfig eth0 down
to turn off ethernet, which is the default if you have not changed your /config/network file

Code: Select all

ifconfig eth0 up
brings it back up if you can't get wlan working.

I have a tower so no wlan showing in this post snippet

User avatar
brokenman
Site Admin
Site Admin
Posts: 5439
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: code snippets, anyone to add

Post#6 by brokenman » 14 Nov 2015, 12:42

ifconfig is being deprecated for some reason. It's a plot to make us type more crap to get what we want.

ip addr <--- show ip address.
ip link set eth0 up <--- put network up/down
How do i become super user?
Wear your underpants on the outside and put on a cape.

aus9

Re: code snippets, anyone to add

Post#7 by aus9 » 14 Nov 2015, 23:24

ifconfig is being deprecated for some reason
it still works for me altho there are some delays. running the "down" command the nm applet shows disconnection occurs after a few seconds.
Running the "up" command takes a lot longer, maybe because my settings are not perfect, but for me about 15 seconds.

aus9

Re: code snippets, anyone to add

Post#8 by aus9 » 14 Nov 2015, 23:26

Having just seen a post by ElectriQT

more of bookmark than code snippets

https://wiki.archlinux.org/index.php/Pacman/Rosetta

web page contains heaps of code snippets on handling packages thru pacman

aus9

Re: code snippets, anyone to add

Post#9 by aus9 » 15 Nov 2015, 23:10

Having just seen a post by Blaze

Code: Select all

cat /proc/cmdline

will show what the bootloader menu for the kernel line

this works for grub not sure it works for all bootloaders

aus9

Re: code snippets, anyone to add

Post#10 by aus9 » 15 Nov 2015, 23:13

Having seen a recent post by brokenman

Instead of showing the code boxes a link as he has a several all worthy of mention
viewtopic.php?f=137&t=5066

User avatar
brokenman
Site Admin
Site Admin
Posts: 5439
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: code snippets, anyone to add

Post#11 by brokenman » 16 Nov 2015, 04:01

This is a nice command:
PATH=pretending! /usr/bin/which sense
^Saccharine is a sugar substitution.
How do i become super user?
Wear your underpants on the outside and put on a cape.

aus9

Re: code snippets, anyone to add

Post#12 by aus9 » 17 Nov 2015, 00:22

@ncmprhnsbl or @brokenman

When you get a chance can you study this output. I am happy to edit and remove later etc.
Bottom line is pman command the only needed one meaning I can forgo the others?

Code: Select all

setup-pman
gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
gpg: no ultimately trusted keys found
gpg: starting migration from earlier GnuPG versions
gpg: porting secret keys from '/etc/pacman.d/gnupg/secring.gpg' to gpg-agent
gpg: migration succeeded
gpg: Generating pacman keyring master key...
gpg: key BEE3D19C marked as ultimately trusted
gpg: directory '/etc/pacman.d/gnupg/openpgp-revocs.d' created
gpg: Done
==> Updating trust database...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
==> Appending keys from archlinux.gpg...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
==> Locally signing trusted keys in keyring...
  -> Locally signing key 0E8B644079F599DFC1DDC3973348882F6AC6A4C2...
  -> Locally signing key 684148BB25B49E986A4944C55184252D824B18E8...
  -> Locally signing key 44D4A033AC140143927397D47EFD567D4C7EA887...
  -> Locally signing key 27FFC4769E19F096D41D9265A04F9397CDFD6BB0...
  -> Locally signing key AB19265E5D7D20687D303246BA1DFB64FFF979E7...
==> Importing owner trust values...
gpg: inserting ownertrust of 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
==> Disabling revoked keys in keyring...
  -> Disabling key F5A361A3A13554B85E57DDDAAF7EF7873CFD4BB6...
  -> Disabling key 7FA647CD89891DEDC060287BB9113D1ED21E1A55...
  -> Disabling key D4DE5ABDE2A7287644EAC7E36D1A9E70E19DAA50...
  -> Disabling key BC1FBE4D2826A0B51E47ED62E2539214C6C11350...
  -> Disabling key 9515D8A8EAB88E49BB65EDBCE6B456CAF15447D5...
  -> Disabling key 4A8B17E20B88ACA61860009B5CED81B7C2E5C0D2...
  -> Disabling key 63F395DE2D6398BBE458F281F2DBB4931985A992...
  -> Disabling key 0B20CA1931F5DA3A70D0F8D2EA6836E1AB441196...
  -> Disabling key 8F76BEEA0289F9E1D3E229C05F946DED983D4366...
  -> Disabling key 66BD74A036D522F51DD70A3C7F2A16726521E06D...
  -> Disabling key 81D7F8241DB38BC759C80FCE3A726C6170E80477...
  -> Disabling key E7210A59715F6940CF9A4E36A001876699AD6E84...
==> Updating trust database...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   5  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1  valid:   5  signed:  64  trust: 0-, 0q, 0n, 5m, 0f, 0u
gpg: depth: 2  valid:  64  signed:   6  trust: 64-, 0q, 0n, 0m, 0f, 0u
gpg: next trustdb check due at 2016-01-22

 It seems you have not optimized your mirror list. 

I can find the fastest package mirror for you.

Would you like to do that now? [y/n]y
Please wait ...

Testing ALL the mirrors could take a long time.
To make it faster I will only search for mirrors in Australia
Enter the number of mirrors you want to test [1-5]: 5
 Finding fastest mirror ... 

 Updated to fastest mirror. 


 Mirror list was successfully updated: 

Server = http://archlinux.mirror.digitalpacific.com.au/$repo/os/$arch
Server = http://ftp.iinet.net.au/pub/archlinux/$repo/os/$arch
Server = http://mirror.internode.on.net/pub/archlinux/$repo/os/$arch
Server = http://mirror.aarnet.edu.au/pub/archlinux/$repo/os/$arch

 Updating database ... 

==> Pre-4.2 database format detected - upgrading...
:: Synchronizing package databases...
 core                                                     122.1 KiB   297K/s 00:00 [################################################] 100%
 extra                                                   1807.3 KiB   318K/s 00:06 [################################################] 100%
 community                                                  3.1 MiB   318K/s 00:10 [################################################] 100%
 Updating certificates /// 

df: ‘/porteus’: No such file or directory
 Changes are not on a real file system. 


 It seems you are not saving your changes. 

Would you like to create a module from your settings? [y/n]y
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on /tmp/pacman-settings.xzm, block size 262144.
[===========================================================================================================================-] 29/29 100%

Exportable Squashfs 4.0 filesystem, xz compressed, data block size 262144
	compressed data, compressed metadata, compressed fragments, compressed xattrs
	duplicates are removed
Filesystem size 5581.97 Kbytes (5.45 Mbytes)
	99.12% of uncompressed filesystem size (5631.29 Kbytes)
Inode table size 350 bytes (0.34 Kbytes)
	44.53% of uncompressed inode table size (786 bytes)
Directory table size 426 bytes (0.42 Kbytes)
	77.60% of uncompressed directory table size (549 bytes)
Number of duplicate files found 2
Number of inodes 22
Number of files 11
Number of fragments 1
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 1
Number of directories 10
Number of ids (unique uids + gids) 1
Number of uids 1
	root (0)
Number of gids 1
	root (0)

5.5M	/tmp/pacman-settings.xzm

/tmp/pacman-settings.xzm was moved to your modules directory.
This means that changes will persist at next boot.
root /home/guest # ls $MODDIR
pacman-settings.xzm
root /home/guest # pacman-db-upgrade
root /home/guest # pacman -Sy
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
root /home/guest # pacman-key --init
root /home/guest # pacman-key --populate archlinux
==> Appending keys from archlinux.gpg...
==> Locally signing trusted keys in keyring...
  -> Locally signing key 0E8B644079F599DFC1DDC3973348882F6AC6A4C2...
  -> Locally signing key 684148BB25B49E986A4944C55184252D824B18E8...
  -> Locally signing key 44D4A033AC140143927397D47EFD567D4C7EA887...
  -> Locally signing key 27FFC4769E19F096D41D9265A04F9397CDFD6BB0...
  -> Locally signing key AB19265E5D7D20687D303246BA1DFB64FFF979E7...
==> Importing owner trust values...
==> Disabling revoked keys in keyring...
  -> Disabling key F5A361A3A13554B85E57DDDAAF7EF7873CFD4BB6...
  -> Disabling key 7FA647CD89891DEDC060287BB9113D1ED21E1A55...
  -> Disabling key D4DE5ABDE2A7287644EAC7E36D1A9E70E19DAA50...
  -> Disabling key BC1FBE4D2826A0B51E47ED62E2539214C6C11350...
  -> Disabling key 9515D8A8EAB88E49BB65EDBCE6B456CAF15447D5...
  -> Disabling key 4A8B17E20B88ACA61860009B5CED81B7C2E5C0D2...
  -> Disabling key 63F395DE2D6398BBE458F281F2DBB4931985A992...
  -> Disabling key 0B20CA1931F5DA3A70D0F8D2EA6836E1AB441196...
  -> Disabling key 8F76BEEA0289F9E1D3E229C05F946DED983D4366...
  -> Disabling key 66BD74A036D522F51DD70A3C7F2A16726521E06D...
  -> Disabling key 81D7F8241DB38BC759C80FCE3A726C6170E80477...
  -> Disabling key E7210A59715F6940CF9A4E36A001876699AD6E84...
==> Updating trust database...
gpg: next trustdb check due at 2016-01-22
It looks like it but best to get confirmation before I edit my post above eh?

User avatar
brokenman
Site Admin
Site Admin
Posts: 5439
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: code snippets, anyone to add

Post#13 by brokenman » 17 Nov 2015, 00:57

Yes. setup-pman wil ...
1) Run pacman-db-upgrade
2) Set up your gpg keys
3) Update your mirrorlist
4) Update the pacman database
5) Save a module

After this you can simply run: pman -Sy when you want to update the database.
EDIT:
This means the minute that you run: setup-pman
There is no need to run pacman -Sy again since it was just run. If you chose to build a module from pacman-settings and it is in your modules folder, then you only need to run pacman -Sy after a couple of days to upgrade the database.
How do i become super user?
Wear your underpants on the outside and put on a cape.

aus9

Re: code snippets, anyone to add

Post#14 by aus9 » 17 Nov 2015, 04:20

Thanks post 2 changed reflect some of your changes

aus9

Re: useful commands , anyone to add

Post#15 by aus9 » 11 Dec 2015, 09:45

Ok based on the cmdline post above....a small test script to ensure a script checks for changes cheatcode and exits if found

Code: Select all

#!/bin/bash
if grep -q changes /proc/cmdline; then
echo 'You booted with a changes cheatcode, please reboot without any changes cheatcode'
exit 1
fi

Post Reply