Ubuntu
===
[toc]
## Commands
### 1.1 Sudo last command
`sudo !!`
### 1.2 No need to write Sudo everytime | Root
`sudo -s `
## Create icon
```
cd /usr/share/applications
sudo gedit APP_NAME.desktop
```
Write the below lines
```==
[Desktop Entry]
Name=UnityHub
Comment=UnityHub 3D Game
Exec=/home/jitesh/3d/Unity/UnityHub.AppImage
Icon=/home/jitesh/Pictures/Unity.png
Terminal=false
Type=Application
Categories=Graphics;
```
:::spoiler or create icon for a command
```==
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
TerminalOptions=bash
Exec=bash -c "source /opt/ros/indigo/setup.bash;source ~/YOUR/CATKIN/WORKSPACE/devel/setup.bash;/path/to/script.sh"
Icon=/if/you/want/one/icon.png
Name=rosapp
```
:::
## Extact data from AppImage ([Ref](https://askubuntu.com/questions/1115321/extract-icon-from-appimage))
**First**, look if your AppImage file is using the newest version of its internal format:
/path/to/your.AppImage --appimage-help
If you see the following line in the output:
--appimage-extract Extract content from embedded filesystem image
you can conclude yourself how to proceed. In this case you have a (newer) *type 2* AppImage format in front of you. (The 'path' part of the command may be relative or absolute.)
**Second**, if the first command didn't work, you can use a helper tool. However, you need sudo/root privileges for this: *[download `appimagetool`](https://github.com/AppImage/AppImageKit/releases)* (which off course is available as an AppImage). Make it executable and run:
/path/to/appimagetool-x86_64.AppImage --list /path/to/your.AppImage
This should give you a list of all files and their (relative) paths embedded in *your.AppImage*. To extract *your.AppImage* into a directory named and located at */path/to/somedir* , run
mkdir /path/to/somedir
/path/to/appimagetool-x86_64.AppImage /path/to/your.AppImage /path/to/somedir
**Third**, you can mount AppImages (type 1 as well as type 2) without the helper tool too:
* **Type 1:**
````
mkdir mountpoint
sudo mount -o loop my.AppImage mountpoint/
# You can now inspect the contents
# You can now also copy the contents to a writable location of your hard disk
sudo umount mountpoint/
# Do not forget the umount step!
# If you do forget it, your system may exhibit unwanted behavior.
````
* **Type 2:**
````
mkdir mountpoint
my.AppImage --appimage-offset
123456 # This is just an example output
sudo mount my.AppImage mountpoint/ -o offset=123456
# you can now inspect the contents
sudo umount mountpoint/
# Do not forget the umount step!
# If you do forget it, your system may exhibit unwanted behavior.
````
***Hint for the 'paranoid':*** If you do not want to trust the AppImage, the third method is preferable. Because running (for type 2 AppImages) `the.AppImage --appimage-extract` or `the.AppImage --appimage-mount` or `the.AppImage --appimage-offset` means you are actually executing an AppImage (though not its content).
## Fix errors with apt update
#### Method 1
`sudo rm -rf /var/lib/apt/lists/*`
##### Update:
To answer the question of @jayarjo in the comment below (*how to re-package the AppImage after modifications?*):
1. You can use *appimagetool* not just to extract an existing AppImage into an AppDir. You can use it to also re-package the AppDir (possibly after some changes) back into a (modified) AppImage.
1. Just run
appimagetool -v /path/to/AppDir
Watch output of command (made verbose by *`-v`*) for the location and name of the newly created AppImage. That's it.
#### Method 2
Update the apt list
```
code /etc/apt/sources.list
```
Or check and update here
```
ls /etc/apt/sources.list.d
```
## Fix resolution
#### Method 1
open the file
```
sudo nano /etc/default/grub
```
find the line
#GRUB_GFXMODE=640x480
edit 640x480 to your resolution eg: 1920x1080, remove the #
for example:
> GRUB_GFXMODE=1920x1080
Update by the command
```
sudo update-grub
```
Then reboot your computer.
```
sudo reboot
```
## Bluetooth
```
sudo apt install bluez-tools
bt-device - a bluetooth device manager
```
```
options snd-hda-intel model=Galaxy Buds (E356)
```
## Different wallpapers on all monitors
```
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub org.gabmus.hydrapaper
flatpak run org.gabmus.hydrapaper
```