Tag: working environment

Xfce boots without Taskbar and Start button (SOLVED)

From time to time my Kali Linux with Xfce desktop environment boots up without the taskbar and start button. Only desktop shortcuts and the desktop itself are visible, that is, the system looks like this (this is a full, uncropped screen).

It is almost impossible to work in such a system, although Linux works, it allows you to open a terminal window, launch desktop shortcuts.

Usually in this case, I right-clicked on the desktop, selected “Open Terminal Here” from the context menu, and entered the command to reboot the system:

reboot

After a reboot, the Taskbar might or might not appear, just as it did when the computer was turned on.

I don't know if this is a problem with my personal Kali Linux and Xfce installation, or a bug in the desktop environment or VirtualBox.

In addition to rebooting the entire system, there is another, faster way to reboot the desktop.

To do this, press the Win key.

This will open the Operating System Menu.

Click the “Log Out” button with the mouse.

Select “Log Out”.

You will be prompted to enter a username and password to log in.

Enter your username and password.

Now Xfce has booted up normally, with the Taskbar and other elements.

To quickly log out of Linux, you can use the keyboard shortcut Ctrl+Alt+Delete.

Alternatively, you can restart the Display Manager with the following command:

sudo systemctl restart lightdm

To enter it, open the terminal, this can be done by right-clicking on the desktop and selecting “Open Terminal Here”, or use the keyboard shortcut Ctrl+Alt+t

How to install PowerShell on Arch Linux, Manjaro, BlackArch

PowerShell on Linux

PowerShell is a cross-platform automation and configuration tool/platform. PowerShell has a large number of system administration-oriented commands. But at the same time, PowerShell is a full-fledged programming language that allows you to write functional programs (scripts).

Note that PowerShell 5 is currently preinstalled on Windows by default, but this manual shows the installation of the latest version of PowerShell 7. On Windows, you can also install PowerShell 7.

Due to the differences between Windows and Linux operating systems, not all PowerShell functions work on Linux.

Installing PowerShell 7 on Arch Linux, Manjaro, BlackArch

It is recommended to install the pikaur utility according to the article “Automatic installation and update of AUR packages” and then just run the command:

pikaur -S powershell-bin

If you don't want to install pikaur, then run the following command sequence to install PowerShell:

git clone https://aur.archlinux.org/powershell-bin.git
cd powershell-bin
makepkg -si

How to run PowerShell on Arch Linux, Manjaro, BlackArch

To start an interactive PowerShell session, run the command:

pwsh

Linux PowerShell Examples

To list all PS commands on your computer, open PowerShell (pwsh command), and enter there:

Get-Command

It is possible to filter the information displayed by the Get-Command command. Let's say you want to see PowerShell commands containing the word “Alias”, for this you need to run the following command:

Get-Command -Name *Alias

To display help about a command (cmdlet) use the following:

Get-Help COMMANDLET

For example, to display help about the Get-Alias cmdlet:

Get-Help Get-Alias

To get the most complete help on Get-Command, do the following:

Get-Help Get-Command -Full

To display the contents of a folder (in this case the root of the file system), run:

Get-ChildItem /

To list processes run:

Get-Process

To stop the process with ID 10500 use the command as shown below:

Get-Process -Id 10500 | Stop-Process

See also “Linux PowerShell Basics (Beginner's Guide)”.

How to install PowerShell in Linux Mint

The PowerShell installation instructions often forget about Linux Mint, apparently, their authors believe that Linux Mint users do not need PowerShell. Let's fill that gap and take a look at how to install PowerShell in Linux Mint.

Linux Mint has several versions - “regular”, which, by the way, also differs in desktop environments (Cinnamon, MATE, Xfce) and LMDE (stands for Linux Mint Debian Edition).

How to install PowerShell in Linux Mint 20.1 (Cinnamon, MATE, Xfce)

Installing PowerShell in Linux Mint is the same regardless of the desktop environment (Cinnamon, MATE, Xfce).

Update the package list:

sudo apt update

Install the dependencies:

sudo apt install -y wget apt-transport-https software-properties-common

Download the GPG keys of the Microsoft repository:

wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb

Register the GPG keys for the Microsoft repository:

sudo dpkg -i packages-microsoft-prod.deb

Update the package list after adding packages.microsoft.com:

sudo apt update

Enable the “universe” repositories:

sudo add-apt-repository universe

Install PowerShell:

sudo apt install -y powershell

Start PowerShell:

pwsh

PowerShell will update automatically when all packages on the system are updated. You can separately launch the PowerShell update with the commands:

sudo apt update
sudo apt install powershell

If you want to remove PowerShell from Linux Mint, then run the command:

sudo apt remove powershell

How to install PowerShell in LMDE

Download the GPG keys of the Microsoft repository:

wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb

Add the GPG keys for the Microsoft repository:

sudo dpkg -i packages-microsoft-prod.deb

Update the list of programs:

sudo apt update

Install PowerShell:

sudo apt install -y powershell

Starting PowerShell:

pwsh

PowerShell will update automatically when all packages on the system are updated. You can separately launch the PowerShell update with the commands:

sudo apt update
sudo apt install powershell

If you want to remove PowerShell from LMDE, then run the command:

sudo apt remove powershell

See also “Linux PowerShell Basics (Beginner's Guide)”.

Source

How to select multiple inconsistent files and other tips for selecting files

You may need to select files in order to copy or delete several files at once. To select one file, just click on it with the left mouse button.

How to select all files

To select all files in a folder, go to that directory and press Ctrl+a on your keyboard. This keyboard shortcut works in all file managers.

You can also select the first file, and then press the Shift key and click on the last file, as a result they will all be selected.

How to select multiple consecutive files

If you need to select a range of files, then click on the first of them, and then hold down the Shift key and click on the last in the range that you want to select.

How to select files without using a mouse

Use the cursor keys to select the first file. If the cursor is in another panel, then use the Tab key to switch to the file panel.

Navigate to the first file you want to select.

Press the Shift key.

Without releasing Shift, move the cursor keys to the end of the file list you want to select.

When you reach the file you want, release the Shift key.

How to select multiple inconsistent files

If you select one or more files, and then move to another file and try to select it, then the selection from the first file will be deselected.

To continue selecting any number of files, press the Ctrl key before clicking the mouse. It is not necessary to hold it all the time - most importantly, do not forget to press Ctrl before selecting the next file.

How to deselect files

To deselect files, just click anywhere in the window of your file manager.

How to Run a Program Automatically on Startup in Linux

If you want a program or script to run when the system starts up, then this can be done using systemctl. This method is universal: autorun also works on headless servers, not just when you enter a graphical desktop environment. This method is universal and will work on all systems where systemctl is present (e.g. Debian, Linux Mint, Ubuntu, Kali Linux, Arch Linux, etc.).

To add a script to autoload in Linux, you need to create a specific file in the /etc/systemd/system/ directory. Choose your own file name. For example, I want to run a script on startup that contains several rules to hinder DOS attacks. This file is located at /root/firewall.sh

We start by assigning the correct permissions to the file:

chmod 755 /root/firewall.sh

Make sure the file has shebang #!/bin/bash (or whatever matches the contents of the file).

I create a file anti-dos.service (you can choose your own name):

vim /etc/systemd/system/anti-dos.service

Content of my file

[Unit]
Description=Initial anti-DOS protection.

[Service]
ExecStart=/root/firewall.sh

[Install]
WantedBy=multi-user.target

Here

  • Description=Initial anti-DOS protection. - this is a description, replace the description with your own.
  • ExecStart=/root/firewall.sh - full path to the file that I want to add to startup is specified.

Don't write something like “ExecStart=/bin/sh /path/to/script.sh” as that won't work. If you really want to specify an interpreter and a script, then use a construction like this:

/usr/bin/bash -c 'INTERPRETER /PATH/TO/SCRIPT'

For instance:

/usr/bin/bash -c 'php /root/bin/translator.php'

Example file using this construction

[Unit]
Description=Launch translator.
 
[Service]
ExecStart=/usr/bin/bash -c 'php /root/bin/translator.php'
 
[Install]
WantedBy=multi-user.target
  • WantedBy=multi-user.target - means that autorun is made for all users.

To start the services in the current session (change the name anti-dos.service to the name of your file):

systemctl start anti-dos.service

To check the status of a service:

systemctl status anti-dos.service

To enable autostart, you need to do this (change the name anti-dos.service to the name of your file):

systemctl enable anti-dos.service

Creating a link says that adding to autostart worked:

Let's restart the server to check))

The screenshot above shows that everything worked properly. The fact that the process is shown as deceased, in my case, is normal. Since I added not a service to autostart, but a one-time script.

To make sure that the firewall settings are in effect, I type:

iptables --list

Yes, my firewall rules are there.

You can also find your autorun file in the list of everything added to startup:

systemctl list-unit-files

After editing files with the extension .service, for the changes to take effect, you need to run the command:

systemctl daemon-reload
Loading...
X