I want to list all services that starts with the letters lc-. Then I want to restart them.
How can I attchive this? I was thinking something like:
systemctl -l | grep ?? | systemctl restart ???
I want to list all services that starts with the letters lc-. Then I want to restart them.
How can I attchive this? I was thinking something like:
systemctl -l | grep ?? | systemctl restart ???
I am trying to install kubectx and kubens on Ubuntu running in Terminal on Windows 11.
sudo git clone https://github.com/ahmetb/kubectx /opt/kubectx
sudo ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx
sudo ln -s /opt/kubectx/kubens /usr/local/bin/kubens
Completion:
mkdir -p ~/.oh-my-zsh/completions
chmod -R 755 ~/.oh-my-zsh/completions
ln -s /opt/kubectx/completion/kubectx.zsh ~/.oh-my-zsh/completions/_kubectx
ln -s /opt/kubectx/completion/kubens.zsh ~/.oh-my-zsh/completions/_kubens
Aliases:
nano ~/.zshrc
# Personal aliases
alias kns=kubens
alias kctx=kubectx
rm -f ~/.zcompdump; compinit
When I now restart the terminal I get the following errors:
compinit:503: no such file or directory: /home/s/.oh-my-zsh/completions/_kubectx
compinit:503: no such file or directory: /home/s/.oh-my-zsh/completions/_kubens
compinit:503: no such file or directory: /home/s/.oh-my-zsh/completions/_kubectx
compinit:503: no such file or directory: /home/s/.oh-my-zsh/completions/_kubens
What did I do wrong?
I want to install k9s on Ubuntu WSL on Windows 11.
When I try to install it I get an error that snapd is down:
➜ ~ sudo snap install k9s
error: cannot communicate with server: Post http://localhost/v2/snaps/k9s: dial unix /run/snapd.socket: connect: no such file or directory
When I start snapd I get a new error:
➜ ~ systemctl start snapd.service
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Anyone know how I shoudl proceed?
I want to connect my Mac and my Ubuntu togheter to transfer files, but because of this I need a Thunderbolt 3 PCI extension card. I've been looking for some time on diffrent websites but I am unsure that Ubuntu 20.10 supports them? Can anyone suggest a card for me or confirm that Ubuntu has drivers?
ASUS ThunderboltEX 3-TR
https://www.asus.com/Motherboards-Components/Motherboards/Accessories/THUNDERBOLTEX-3-TR/HelpDesk_Download/
Lenovo ThinkStation Rear Riser card Thunderbolt 3
https://www.lenovo.com/us/en/accessories-and-monitors/cables-and-adapters/adapters/ACCKIT-BO-Rear-TBT-to-PCIe-Riser-Card/p/4XH0Y77510
I have found that this command gives me the mime type from a file:
file --mime-type dog.jpeg
Output:
dog.jpeg: image/jpeg
I am now trying to create a bash checks if the mime is jpeg og png. However I am a bit stuck:
#!/bin/bash
$file_mime="file --mime-type dog.jpeg"
mime=`"${file_mime#*:}"`
if(mime=='image/jpg' OR mime=='image/png') do:
echo"Jpg or png"
done
Output:
./bash.sh: line 2: =file --mime-type dog.jpeg: command not found
./bash.sh: line 3: : command not found
I have installed RStudio 1.4 on my Ubuntu 20.10 machine. I have also installed texlive:
sudo apt-get install texlive
I can now create PDF files with RStudio. However if I add a bash script to my RStudio RMarkdown file I get error:
running: bash -c 'date
'
output file: wd1b.knit.md
! LaTeX Error: File `framed.sty' not found.
! Emergency stop.
<read *>
I am going to use "file" to check file type of a buch of files. I need to get it to print output file mime type without charset part.
My code:
file dog.jpeg -i
Output:
dog.jpeg: image/jpeg; charset=binary
What I want:
dog.jpeg: image/jpeg
Im trying to install a program called volatility for memory analyzing. I found the source here: https://github.com/volatilityfoundation/volatility
Commands:
sudo apt-get update -y
sudo apt-get install -y volatility
Error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package volatility is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'volatility' has no installation candidate
I have a file written in LibreOffice. I want to check the meta data for it. How can I install/use "odt-meta" for Ubuntu to check metadata for odt-files?
Im trying to install the latest version of Scalpel from https://github.com/machn1k/Scalpel-2.0. The normal Ubuntu install "sudo apt-get install scalpel" doesnt give me the latest version, so Im trying to get the latest version.
I have fixed the issue, i just missed libtre-dev.
How to install Scalpel-2.0:
First install Build Essential and Libtre-dev:
sudo apt-get install build-essential
sudo apt-get install libtre-dev
Now install Scalpel:
git clone https://github.com/machn1k/Scalpel-2.0.git
cd Scalpel-2.0/
./configure
make
I am trying to install RegRipper on my Ubuntu 19.10 desktop machine. RegRipper is a program that can analyze registry files from Windows. Its avaible here: https://github.com/keydet89/RegRipper2.8.git
First install Git
sudo apt-get install git
Install Win32Registry
perl -MCPAN -e 'install Parse::Win32Registry'
Install Regripper
cd /opt
sudo git clone https://github.com/keydet89/RegRipper2.8.git
sudo mv RegRipper2.8 regripper
sudo chown -R $USER:$USER regripper
Make shell
# Fix end of line
cd /opt/regripper
sudo cat rip.pl | sed 's|\r$||g' > /tmp/riplin0.pl
# Now fix the first line so linux perl executed
sudo cat /tmp/riplin0.pl | sed "s| c:\\\\perl\\\\bin\\\\perl.exe|`which perl`|" > /tmp/riplin1.pl
# Fix the backslash before the plugins directory
sudo cat /tmp/riplin1.pl | sed 's|plugins\\\\|plugins/|' > riplin.pl
# Make executable
sudo chmod +x riplin.pl
When I now try to execute riplin I get a error:
opt/regripper$ ./riplin.pl -l
Can't locate Parse/Win32Registry.pm in @INC (you may need to install the Parse::Win32Registry module) (@INC contains: /home/xxx/perl5/lib/perl5/5.28.1/x86_64-linux-gnu-thread-multi /home/xxx/perl5/lib/perl5/5.28.1 /home/xxx/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/xxx/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /home/xxx/perl5/lib/perl5/5.28.0 /home/xxx/perl5/lib/perl5/5.28.0/x86_64-linux-gnu-thread-multi /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./riplin.pl line 29. BEGIN failed--compilation aborted at ./riplin.pl line 29.
So the error is Can't locate Parse/Win32Registry.pm. On line 29 of riplin.pl it says use Parse::Win32Registry qw(:REG_);
riplin.pl
#!/usr/bin/perl
#-------------------------------------------------------------------------
# Rip - RegRipper, CLI version
# Use this utility to run a plugins file or a single plugin against a Reg
# hive file.
#
# Output goes to STDOUT
# Usage: see "_syntax()" function
#
# Change History
# 20190318 - modified code to allow the .exe to be run from anywhere within the file system
# 20190128 - added Time::Local, modifications to module Key.pm
# 20180406 - added "-uP" switch to update profiles
# 20130801 - added File::Spec support, for cross-platform compat.
# 20130716 - added 'push(@INC,$str);' line based on suggestion from
# Hal Pomeranz to support Linux compatibility
# 20130425 - added alertMsg() functionality, updated to v2.8
# 20120506 - updated to v2.5 release
# 20110516 - added -s & -u options for TLN support
# 20090102 - updated code for relative path to plugins dir
# 20080419 - added '-g' switch (experimental)
# 20080412 - added '-c' switch
#
# copyright 2013-2019 Quantum Analytics Research, LLC
# Author: H. Carvey, [email protected]
#
#-------------------------------------------------------------------------
use strict;
use Parse::Win32Registry qw(:REG_);
use Getopt::Long;
use Time::Local;
use File::Spec;
# Included to permit compiling via Perl2Exe
#perl2exe_include "Parse/Win32Registry.pm";
#perl2exe_include "Parse/Win32Registry/Key.pm";
#perl2exe_include "Parse/Win32Registry/Entry.pm";
#perl2exe_include "Parse/Win32Registry/Value.pm";
#perl2exe_include "Parse/Win32Registry/File.pm";
#perl2exe_include "Parse/Win32Registry/Win95/File.pm";
#perl2exe_include "Parse/Win32Registry/Win95/Key.pm";
#perl2exe_include "Encode.pm";
#perl2exe_include "Encode/Byte.pm";
#perl2exe_include "Encode/Unicode.pm";
#perl2exe_include "utf8.pm";
#perl2exe_include "unicore/Heavy.pl";
#perl2exe_include "unicore/To/Upper.pl";
my %config;
Getopt::Long::Configure("prefix_pattern=(-|\/)");
GetOptions(\%config,qw(reg|r=s file|f=s csv|c guess|g user|u=s sys|s=s plugin|p=s update|uP list|l help|?|h));
# Code updated 20090102
my @path;
my $str = $0;
($^O eq "MSWin32") ? (@path = split(/\\/,$0))
: (@path = split(/\//,$0));
$str =~ s/($path[scalar(@path) - 1])//;
# Suggested addition by Hal Pomeranz for compatibility with Linux
#push(@INC,$str);
# code updated 20190318
my $plugindir;
($^O eq "MSWin32") ? ($plugindir = $str."plugins/")
: ($plugindir = File::Spec->catfile("plugins"));
#my $plugindir = $str."plugins/";
#my $plugindir = File::Spec->catfile("plugins");
#print "Plugins Dir = ".$plugindir."\n";
# End code update
my $VERSION = "2\.8_20190318";
my @alerts = ();
if ($config{help} || !%config) {
_syntax();
exit;
}
#-------------------------------------------------------------
#
#-------------------------------------------------------------
if ($config{list}) {
my @plugins;
opendir(DIR,$plugindir) || die "Could not open $plugindir: $!\n";
@plugins = readdir(DIR);
closedir(DIR);
my $count = 1;
print "Plugin,Version,Hive,Description\n" if ($config{csv});
foreach my $p (@plugins) {
next unless ($p =~ m/\.pl$/);
my $pkg = (split(/\./,$p,2))[0];
# $p = $plugindir.$p;
$p = File::Spec->catfile($plugindir,$p);
eval {
require $p;
my $hive = $pkg->getHive();
my $version = $pkg->getVersion();
my $descr = $pkg->getShortDescr();
if ($config{csv}) {
print $pkg.",".$version.",".$hive.",".$descr."\n";
}
else {
print $count.". ".$pkg." v.".$version." [".$hive."]\n";
# printf "%-20s %-10s %-10s\n",$pkg,$version,$hive;
print " - ".$descr."\n\n";
$count++;
}
};
print "Error: $@\n" if ($@);
}
exit;
}
#-------------------------------------------------------------
#
#-------------------------------------------------------------
if ($config{update}) {
my @plugins;
opendir(DIR,$plugindir) || die "Could not open $plugindir: $!\n";
@plugins = readdir(DIR);
closedir(DIR);
# hash of lists to hold plugin names
my %files = ();
foreach my $p (@plugins) {
next unless ($p =~ m/\.pl$/);
# $pkg = name of plugin
my $pkg = (split(/\./,$p,2))[0];
# $p = $plugindir.$p;
$p = File::Spec->catfile($plugindir,$p);
eval {
require $p;
my $hive = $pkg->getHive();
my @hives = split(/,/,$hive);
foreach my $h (@hives) {
my $lch = lc($h);
$lch =~ s/\.dat$//;
$lch =~ s/^\s+//;
push(@{$files{$lch}},$pkg);
}
};
print "Error: $@\n" if ($@);
}
# once hash of lists is populated, print files
foreach my $f (keys %files) {
my $filepath = $plugindir."\\".$f;
open(FH,">",$filepath) || die "Could not open ".$filepath." to write: $!";
for my $i (0..$#{$files{$f}}) {
next if ($files{$f}[$i] =~ m/tln$/);
print FH $files{$f}[$i]."\n";
}
close(FH);
}
exit;
}
#-------------------------------------------------------------
#
#-------------------------------------------------------------
if ($config{file}) {
# First, check that a hive file was identified, and that the path is
# correct
my $hive = $config{reg};
die "You must enter a hive file path/name.\n" if ($hive eq "");
# die $hive." not found.\n" unless (-e $hive);
my %plugins = parsePluginsFile($config{file});
if (%plugins) {
logMsg("Parsed Plugins file.");
}
else {
logMsg("Plugins file not parsed.");
exit;
}
foreach my $i (sort {$a <=> $b} keys %plugins) {
eval {
# require "plugins/".$plugins{$i}."\.pl";
my $plugin_file = File::Spec->catfile($plugindir,$plugins{$i}.".pl");
require $plugin_file;
$plugins{$i}->pluginmain($hive);
};
if ($@) {
logMsg("Error in ".$plugins{$i}.": ".$@);
}
logMsg($plugins{$i}." complete.");
rptMsg("-" x 40);
}
printAlerts();
}
#-------------------------------------------------------------
#
#-------------------------------------------------------------
if ($config{reg} && $config{guess}) {
# Attempt to guess which kind of hive we have
my $hive = $config{reg};
die "You must enter a hive file path/name.\n" if ($hive eq "");
# die $hive." not found.\n" unless (-e $hive);
my $reg;
my $root_key;
my %guess = guessHive($hive);
foreach my $g (keys %guess) {
::rptMsg(sprintf "%-8s = %-2s",$g,$guess{$g});
}
}
#-------------------------------------------------------------
#
#-------------------------------------------------------------
if ($config{plugin}) {
# First, check that a hive file was identified, and that the path is
# correct
my $hive = $config{reg};
die "You must enter a hive file path/name.\n" if ($hive eq "");
# die $hive." not found.\n" unless (-e $hive);
# check to see if the plugin exists
my $plugin = $config{plugin};
# my $pluginfile = $plugindir.$config{plugin}."\.pl";
my $pluginfile = File::Spec->catfile($plugindir,$config{plugin}."\.pl");
die $pluginfile." not found.\n" unless (-e $pluginfile);
eval {
require $pluginfile;
$plugin->pluginmain($hive);
};
if ($@) {
logMsg("Error in ".$pluginfile.": ".$@);
}
printAlerts();
}
sub _syntax {
print<< "EOT";
Rip v.$VERSION - CLI RegRipper tool
Rip [-r Reg hive file] [-f plugin file] [-p plugin module] [-l] [-h]
Parse Windows Registry files, using either a single module, or a plugins file.
-r Reg hive file...Registry hive file to parse
-g ................Guess the hive file (experimental)
-f [profile].......use the plugin file (default: plugins/plugins)
-p plugin module...use only this module
-l ................list all plugins
-c ................Output list in CSV format (use with -l)
-s system name.....Server name (TLN support)
-u username........User name (TLN support)
-uP ...............Update profiles
-h.................Help (print this information)
Ex: C:\\>rip -r c:\\case\\system -f system
C:\\>rip -r c:\\case\\ntuser.dat -p userassist
C:\\>rip -l -c
All output goes to STDOUT; use redirection (ie, > or >>) to output to a file\.
copyright 2019 Quantum Analytics Research, LLC
EOT
}
#-------------------------------------------------------------
#
#-------------------------------------------------------------
sub logMsg {
print STDERR $_[0]."\n";
}
#-------------------------------------------------------------
#
#-------------------------------------------------------------
sub rptMsg {
binmode STDOUT,":utf8";
if ($config{sys} || $config{user}) {
my @vals = split(/\|/,$_[0],5);
my $str = $vals[0]."|".$vals[1]."|".$config{sys}."|".$config{user}."|".$vals[4];
print $str."\n";
}
else {
print $_[0]."\n";
}
}
#-------------------------------------------------------------
#
#-------------------------------------------------------------
sub alertMsg {
push(@alerts,$_[0]);
}
sub printAlerts {
if (scalar(@alerts) > 0) {
# print "\n";
# print "Alerts\n";
# print "-" x 40,"\n";
foreach (@alerts) {
print $_."\n";
}
}
}
#-------------------------------------------------------------
# parsePluginsFile()
# Parse the plugins file and get a list of plugins
#-------------------------------------------------------------
sub parsePluginsFile {
my $file = $_[0];
my %plugins;
# Parse a file containing a list of plugins
# Future versions of this tool may allow for the analyst to
# choose different plugins files
# my $pluginfile = $plugindir.$file;
my $pluginfile = File::Spec->catfile($plugindir,$file);
if (-e $pluginfile) {
open(FH,"<",$pluginfile);
my $count = 1;
while(<FH>) {
chomp;
next if ($_ =~ m/^#/ || $_ =~ m/^\s+$/);
# next unless ($_ =~ m/\.pl$/);
next if ($_ eq "");
$_ =~ s/^\s+//;
$_ =~ s/\s+$//;
$plugins{$count++} = $_;
}
close(FH);
return %plugins;
}
else {
return undef;
}
}
#-------------------------------------------------------------
# guessHive()
#
#-------------------------------------------------------------
sub guessHive {
my $hive = shift;
my $reg;
my $root_key;
my %guess;
eval {
$reg = Parse::Win32Registry->new($hive);
$root_key = $reg->get_root_key;
};
$guess{unknown} = 1 if ($@);
# Check for SAM
eval {
$guess{sam} = 1 if (my $key = $root_key->get_subkey("SAM\\Domains\\Account\\Users"));
};
# Check for Software
eval {
$guess{software} = 1 if ($root_key->get_subkey("Microsoft\\Windows\\CurrentVersion") &&
$root_key->get_subkey("Microsoft\\Windows NT\\CurrentVersion"));
};
# Check for System
eval {
$guess{system} = 1 if ($root_key->get_subkey("MountedDevices") &&
$root_key->get_subkey("Select"));
};
# Check for Security
eval {
$guess{security} = 1 if ($root_key->get_subkey("Policy\\Accounts") &&
$root_key->get_subkey("Policy\\PolAdtEv"));
};
# Check for NTUSER.DAT
eval {
$guess{ntuser} = 1 if ($root_key->get_subkey("Software\\Microsoft\\Windows\\CurrentVersion"));
};
return %guess;
}
#-------------------------------------------------------------
# getTime()
# Translate FILETIME object (2 DWORDS) to Unix time, to be passed
# to gmtime() or localtime()
#-------------------------------------------------------------
sub getTime($$) {
my $lo = shift;
my $hi = shift;
my $t;
if ($lo == 0 && $hi == 0) {
$t = 0;
} else {
$lo -= 0xd53e8000;
$hi -= 0x019db1de;
$t = int($hi*429.4967296 + $lo/1e7);
};
$t = 0 if ($t < 0);
return $t;
}
I've downloaded a extension called gnome-shell-extension-openweather that gives me the weather forecast for my city. Recently when i boot Ubuntu it gives a message that there is a new version for this extension and that I should update.
But it does not say how to update, and there is no button to update it.
Anyone know how to do this?
This is the app website: https://gitlab.com/jenslody/gnome-shell-extension-openweather