F*@#ing Linux



Things I have found out about whilst trying to use Linux.



What is Unix or Linux -?

UNIX is a copyrighted name, so IBM AIX and Sun Solaris and HP-UX are all UNIX operating systems.

Most UNIX operating systems come complete with multiple manufacturer supported programs such as editor, compilers etc.

Linux is a Unix clone written from scratch by Linus Torvalds with assistance from a team of like minded users and programmers across the Net. if you consider Portable Operating System Interface (POSIX) standards then Linux can be considered as UNIX. Most UNIX operating systems are considered as complete operating system. The Unix operating system contain a kernel which is usually supplied and supported by one of the Unix hardware vendors: IBM, Sun or HP. However, Apple's Mac OS X 10.14 is certified Unix which makes it the most popular UNIX operating system.

GNU/Linux began in 1983, GNU is a recursive acronym for "GNU's Not Unix!", chosen because GNU's design is Unix-like, but differs from Unix by being free and containing no Unix code. GNU project distros usually include a graphical desktop (called GNOME) to help beginners use the GNU system.

Popular nonfree GNU/Linux distributions with a Linux Kernel such Ubuntu, Open-Suse, Linux Mint, Debian (on which Raspbian is Based), Arch, CentOS etc make it a usable complete operating systems by adding various applications.

Linux may be considered by some as a friendly UNIX like operating system but from my limited experience you are expected to know Unix or Linux to be able to navigate it.

For the seriously advanced user Kali Linux is a Debian-derived Linux distribution designed for digital forensics, penetration testing, security authoring and ethical hacking.

How do you get started with Linux

So you have a computer and want to turn it into a linux machine. Your first decision is what version of Linux do you need. A Linux distribution is often abbreviated as distro which is based upon the Linux kernel and, often, a package management system. my preference is a debian based distro but there are many commercial and open source Linux flavours such as.

create bootable os usb disk

Using rufus.exe to create a bootable USB drives the easy way

You will need your distro, I chose Ubuntu but you do need to know whether you are 64bit or 32 bit
LTS is an abbreviation for “Long Term Support”. Ubuntu produce a new Ubuntu Desktop and Ubuntu Server release every six months. You get free security updates for at least 9 months on the desktop and server. A new LTS version is released every 2 years.

First you will need to find out whether your machine is 32 or 64 bit from the command line

From Linux

uname –m

From Windows elevated command prompt

wmic os get osarchitecture

Get your Distro Image Download

If you have a Raspberry Pi, Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. For Rasberry Pi OS on an SD card use Win32DiskImager program rather than Rufus

Then Get your Pi Distro Image Download

Once OS is loaded you will want remote ssh access

sudo apt-get install openssh-server openssh-client

To keep it up to date   this fetches the list of available updates

sudo apt-get update

To keep upgrade up to date   Strictly upgrades the current packages

sudo apt-get upgrade

Installs updates (new ones)

sudo apt-get dist-upgrade>

don't forget to Implement the uncomplicated firewall (ufw) more about UFW here

sudo ufw allow ssh/tcp
sudo ufw logging on
 sudo ufw enable
 ufw status

Listing Folders and Files

ls lists directory contents. When run with the -l option you can use a long listing format ls -l lists owner and group ownerships.

Usually ls -l has an alias as ll in Ubuntu. to check whether ll has an alias:

$ type ll
alias ll='ls -alH'

Taking a look at the manual pages for the command ls, by typing man ls you can see what the extra attributes accomplish together

  • -a: do not ignore entries starting with a period (fullstop).
  • -H: follow symbolic links
  • If you find yourself in need to edit or overwrite a file and if you are not the owner then this creates a problem. The easiest way I found was to temporarily change ownership from "root" to your own "username" which will allow WIN SCP or similar programs to function

    $ ll /path/to/file_name.html
    
    -rw-r--r-- 1 root root 17808 Jan 31 12:44 /path/to/file_name.html

    sudo chown --from=root username /path/to/file_name.html
    
    $ ll /path/to/file_name.html
    
    -rw-r--r-- 1 username root 17806 Jan 31 12:29 /path/to/file_name.html
    $ sudo chown --from=antony root /path/to/file_name.html
    
    -rw-r--r-- 1 root root 17808 Jan 31 12:44 /path/to/file_name.html

    When you need to Kill a Program or Service

    use ps to list processes and find PID for the process.

    ps aux

    or "pidof program_name" say If we wanter to find the pid of streamripper this would lokk like this.

    pidof streamripper
    25282

    alternatively "pgrep program_name"

    pgrep streamripper
    25282

    use the PID with kill to end (kill) the process

    sudo kill 25282

    you could also use the process kill to end (pkill) the process

    sudo pkill streamripper

    Getting my monitor drivers right for a project I am trying to run.

    Linux and Nvidia!

    Linux and the Nvidia drivers have caused me many headaches and after many hours of scouring the internet and trying out different installation methods I hope this will help me in the future if its still broken and starting with the build as above

    Install Nvidia Drivers on Ubuntu 16.04

    The headers are the source code for the kernel and are generally needed when building kernel modules, either manually or with some packages such as nvidia

    sudo apt-get install dkms build-essential linux-headers-generic

    To find out what graphics drivers are now in use

    sudo lspci -nnkv | grep -iA20 vga
    01:00.0 VGA compatible controller [0300]: NVIDIA Corporation NV44A [GeForce 6200] [10de:
    0221] (rev a1) (prog-if 00 [VGA controller])                                            
            Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 16                     
            Memory at f8000000 (32-bit, non-prefetchable) [size=16M]                        
            Memory at e0000000 (32-bit, prefetchable) [size=256M]                           
            Memory at f9000000 (32-bit, non-prefetchable) [size=16M]                        
            [virtual] Expansion ROM at 000c0000 [disabled] [size=128K]                      
            Capabilities: [60] Power Management version 2                                   
            Capabilities: [44] AGP version 3.0                                              
            Kernel driver in use: nouveau                                                   
            Kernel modules: nvidiafb, nouveau

    This will show all the driver packages which apply to your current system

    sudo ubuntu-drivers devices
    == cpu-microcode.py ==
    driver   : intel-microcode - distro non-free
    
    == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
    vendor   : NVIDIA Corporation
    model    : NV44A [GeForce 6200]
    modalias : pci:v000010DEd00000221sv00000000sd00000000bc03sc00i00
    driver   : nvidia-304 - distro non-free recommended
    driver   : xserver-xorg-video-nouveau - distro free builtin

    A good clean start using apt-get

    sudo apt-get purge nvidia*
    sudo apt-get autoremove

    Jump to Ubuntu, Linux and me on....