Skip to content

Latest commit

 

History

History
83 lines (74 loc) · 4.43 KB

File metadata and controls

83 lines (74 loc) · 4.43 KB

Cool Linux Tips

  • after pressing 🪟, you can type nautilus {directory} to open that in files
  • pgrep command: This command searches for processes based on their name and returns their Process IDs (PIDs). To list PIDs of processes matching a name: pgrep <process_name> To list PIDs and process names: pgrep -l <process_name> . similar to ps aux | grep {name} | grep -v grep
  • awk can split text by columbs awk '$1'
  • you can make your own desktop entries! look it up
  • !cool one: use cat your_file.txt | xclip -selection clipboard to copy an entire file to the clipboard
    • BONUS COOL ONE!:
      • I made an alias in bashrc, so just pipe it into copy or clipboard
  • use fzf command to search for files super fast - you can also pipe things into it
  • use SUPER+D to show desktop
  • use alt+space to open menu for an app
  • ctrl+alt+t to open terminal
  • alt+f2 to open this run dialog thing
  • use ventoy for making bootable USBs, just put the iso in the new usb directory thing

desktop entires

  • make desktop entries and put them in ~/.local/share/applications/*.desktop
  • make it executable chmod +x ...
  • you can also supply an icon:
    • add the path under Icon: ...
    • you can also copy the launcher to the desktop

making a bootable windows USB tips

by bootable I mean you open up into a windows desktop, not the installation media

  1. sudo apt install wimtools
  2. use gparted to create a 300MB FAT32 sdX1 partition and fill the rest with NTFS
  3. mount ISO to ~/windowsiso or something like that - mkdir ~/windowsiso, sudo mount -o loop ISO_FILE_HERE.iso ~/windowsiso
  4. mount NTFS to /mnt/windowsusb - mkdir -p /dev/windowsusb, sudo mount /dev/sdX2 /mnt/windowsusb
  5. mount FAT32 to /mnt/windowsusb/boot/eft - mkdir -p /dev/windowsusb/boot/efi, sudo mount /dev/sdX1 /mnt/windowsusb/boot/efi
  6. apply windows image - sudo wimlib-imagex apply ~/windowsiso/sources/install.wim 1 /mnt/windowsusb
  7. install windows bootloader - sudo bcdboot /mnt/windowsusb/Windows /s /mnt/windowsusb/boot/efi /f UEFI
  8. cleanup and unmount - sudo umount /mnt/windowsusb/boot/efi, sudo umount /mnt/windowsusb, sudo umount ~/windowsiso *note that some of these commands need the whole directory to the windows ISO, not ~/

random disk stuff

  • gparted - useful partition tool
  • lsblk - useful thing to list stuff
  • sudo mount -o loop INPUT.iso /home/USER/OUTPUT/ - mount an iso to a certain directory

checking a downloaded file

  • use sha562sum <FILE> and check it against the one provided on the website
  • use echo "EXPECTED_HASH HBCD_PE_x64.iso" | sha256sum --check to check them against each other

pythong venv

  • make one with python3 -m venv path/to/venv
  • open it with source path/to/venv/bin/activate
  • install whatever
  • deactivate with deactivate

git tips

since we're ussualy the only person on a repo, just do this:

  1. git add . - stage your changes
  2. git commit -m "message" - commit ur changes
  3. git push origin main - push changes to remote

docker

create containerized applications - little mini VMs! - helpful to run something anywhere! image - saved application to run - like a floppy disk running/saved run application

  • write a "Dockerfile" - look it up - select a system, set variables, copy files, and then run a start command
  • write a compose.yaml to manage multiple services or define how things should run (args, ports, volumes etc)
    • remember to expose ports ("host:container", "8000:8000")
    • conect container fs with real fs with volumes:
      • "local:container", "./data:/data" - the program ussualy runs in /app
  • run compose.yaml with 'docker compose up' in that directory
    • use -d to run detached
      • attach with docker attach <container name/ID>
      • detach with CTRL+p CTRL+q
    • use 'docker compose down' to stop
  • use docker build -t . to build the Dockerfile in a directory into an image
  • use docker run to create a container from and image and run it
  • use docker start to re-execute a stopped container
  • list images with docker images
  • list running containers with docker ps
  • list all containers(even stopped) with docker ps -a
  • save an image to .tar with docker save
    • send that to wherever you wanna run it!
    • you can also use a container registry (git type thing) to manage images
  • load an image onto the device with docker load <file.tar>
  • open a container with bash with 'docker exec -it /bin/bash'

use "man hier" to figure out linux filesystem hierarchy