Saturday 18 August 2018

Best Laptops of 2018 for Linux


There was a time, not so long ago, when Linux was seen as an outcast operating system and indeed one that was labeled as a ‘cancer’ by Microsoft’s former CEO Steve Ballmer. Times have now changed as the operating system - which launched in September 1991, has made some serious inroads in the server market, then in the cloud – not forgetting that it underpins the most popular ecosystem out there: Android on smartphones.
Because none of the main notebook vendors – bar Dell – offer Linux as an OS option, this leaves other smaller companies the ability to carve a niche for themselves.
Below are the five best Linux laptops of 2018 I have picked out using  expert eye – note that they have been fine-tuned to run a specific flavor of Linux (such as Ubuntu, for example).

1. Dell XPS 13 Developer Edition
Ideal for those looking for a sleek-and-chic portable

Gorgeous design
Plenty of connectivity options
Poor webcam positioning
Little hardware customization
The XPS 13 retains its crown as the undisputed champion of the Ultrabook market, and one can only admire Dell for its unwavering Linux support on a flagship machine.
The laptop is customize able you can configure it to be suitable for everything from routine office tasks to gaming, depending on how much you’re willing to pay.
If you wish, you can plump for the most expensive XPS 13, which has a 4K (3,840 x 2,160) InfinityEdge touchscreen. The slightly more wallet-friendly configuration runs with a Full HD (1,920 x 1,080) 13.3-inch InfinityEdge non-touch display. It’s also worth bearing in mind that the higher-res screen will tax the GPU and CPU more, and may affect battery life adversely.
As this is touted as a 'Developer' edition, it's surprising there aren't more customization options. The basic model - which costs $1049.99 at the time of writing - comes with 4GB of RAM and a 128GB SSD, and cannot be upgraded during checkout. 
The more expensive version allows you to choose between the default 512GB SSD or to pay extra for a 1TB solid-state drive. All models come preinstalled with Ubuntu 16.04 LTS and 8th-generation Intel CPUs.

2. System76 Serval WS
A powerhouse of a laptop, but a hefty beast

Desktop CPU
Up to 64GB system RAM
Hefty price
System76's Serval WS is the ultimate powerhouse of laptops. Available with a 15-inch or 17-inch display, it incorporates an 8th generation Intel Core i7 CPU which is usually found in desktop machines.
The Serval WS is highly customizable incorporating up to 64GB of system RAM and up to 12TB of storage. Buyers are also offered a variety of Nvidia GeForce GTX 10-series GPUs, and gamers will further appreciate the choice of either a Full HD or 4K display.
It's clear that a lot of thought and care has gone into the design of the Serval WS, given that each key on the keyboard comes with its own multi-colour backlight. The laptop, like all System76 models, comes preinstalled either with the firm’s own custom POP!_OS or Ubuntu Linux.
This notebook also offers impressive connectivity chops with both USB 3.1 Type-C and Type-A ports (the exact number of ports varies by model). One thing to be aware of is that this laptop is a fairly hefty beast, with the basic 15-inch model weighing 3.4kg and the 17-inch version tipping the scales at 4.17kg.
This heftiness is matched only by the weighty price tag: the base 15-inch model is equipped with a GTX1060 and a relatively basic 8GB of RAM and a 250GB SSD for storage, but costs an eye-watering $1,989 (around £1,515, AU$2,695).
3. Purism Librem 13
Great for privacy fanatics

Designed to be ultra-secure
Upgrade option to three-year warranty
Rather expensive
Purism embarked upon a quest to build the most secure laptop ever and (obviously) chose Linux (PureOS) to power the device – it is the only notebook vendor on the market to offer physical kill switches as standard on its laptops.
Instead of going mainstream, the company tapped into the crowd funding community to gain more than $430,000 (around £300,000, AU$550,000) worth of funding, allowing it to adopt a stricter ethos than most firms when it comes to privacy, rights to free software and security.
The Librem 13 might look and feel like a bog-standard laptop but there's far more to it than meets the eye (for example, the company designed its own motherboards).
In addition, Purism’s commitment to Linux (and security in general) certainly goes beyond most of the vendors on this list.
4. System76 Oryx Pro
A highly configurable notebook with plenty of potential

Choice of 15.6 or 17.3-inch display
Nicely configurable
Can be very expensive
The Oryx Pro was built for Linux and indeed currently offers a choice of either Ubuntu 16.04 or System76’s own Ubuntu-based Pop!_OS 17.10 on purchase.

The chassis is made from lightweight aluminum with a matte black finish and you even have a choice of display size (15.6 or 17.3-inch). Graphics are provided by GeForce GTX 10 series GPUs and the Oryx packs an Intel Core i7 quad-core processor (with Turbo to 3.8GHz) into its thin frame.
The online store encourages you to customize the Oryx to suit your needs. By default you get 8GB of RAM and a 250GB SSD, but you can pay extra to upgrade to 64GB of system memory with a 2TB SSD if you wish – although the top-end configurations get very expensive here.
You can also choose between Nvidia’s GTX 1060 and GTX 1070 when it comes to the GPU, and it’s possible to add extra drives, or purchase a laptop bag designed to carry and protect your machine. The warranty of the notebook can be extended to provide coverage for three years.
5. System76 Galago Pro
Looking for the ultimate Linux powerhouse?

Extraordinary expansion capabilities
Matte Full HD display as default
A cheaper Full HD version should be offered
On paper, the Galago Pro from System76 is an absolute beast of a machine, and yet it weighs less than most laptops which also have a 13-inch screen. This is a notebook that rivals the Dell XPS 13 Developer Edition, featuring an aluminum chassis, and managing to make space for up to 32GB of RAM (yes, 32GB).

The Galago Pro has two hard drive bays. The 'OS Drive' in the first bay is a 120GB SSD by default but can be specified at up to 2TB when you order. You can also choose to install a second SSD in the other bay of up to 4TB capacity.
If that wasn’t enough, it has a 13.3-inch display with a resolution of 3,200 x 1,800, an Ethernet port, an SD card reader, two USB ports and a Thunderbolt 3/USB Type-C/mini-DisplayPort connector. In a nutshell, you will be hard pressed to get anything in Windows-land that can deliver this sort of compute power and storage capacity.

Thursday 16 August 2018

Linux Based Data Recovery Tools


Data Recovery on Linux Systems
If you are looking for tools to help you recover data on a Linux system, there are plenty to be had. This post offers you a look into what is available for admins to use ─ from full-blown disk recovery suites to individual tools.
Data is the crucial bit in our personal and professional existence. Without data we would be lost in a vast expanse of nothingness. Spreadsheets, email, documents, contacts, databases, files, folders … the list goes on and on. In a perfect world, every byte of local storage would be backed up to an external hard drive or cloud storage service.
See also:




Sometimes data has to be recovered. When that tragedy strikes, it’s good to know you have the tools on hand to get the job done. Thankfully, Linux is no stranger to data recovery. In fact, there are a number of solid tools you can use to get back lost data. I want to introduce you to a few tools that do a great job of recovering data.
As with any instance of recovering lost data ─ nothing is perfect. You can try any of the various tools available only to find the data simply not recoverable. That is the nature of the digital age. To that end, always make sure you have a solid, recent backup available in the event your system goes down hard.

System Rescue CD


Let’s first start with tools to help you recover data from a downed machine (say a machine with file system or partition issues). These tend to be the easiest to work with as they are all-inclusive tools. My favorite of these tools is SystemRescueCD. This particular rescue CD supports most of the known partition formats and includes all the tools you need to recover data (including sfdisk, Gparted, TestDisk, PhotoRec, FSArchiver, and much more) and includes plenty of tools to work with.

Like most rescue disks, SystemRescueCD works by booting your system from either the CD or USB drive and then uses the tools to work with your file system. Unlike a lot of other rescue tools of this nature, SystemRescueCD offers a full-blown graphical environment to aid you in the task of recovering data.
If you are rescuing data from one machine to another, you will need to attach an external hard drive to the system in order to move the rescued data (or you can use the built-in Samba support and copy data to a networked location). If the idea is to recover or repair a partition table, I strongly suggest copying sensitive data over over anyway ─ on the chance the partition table or file system is further damaged.
There are other rescue systems available that are similar in both intent and style as SystemRescueCD. Each has its pros and cons but, in the end, will get the job done. Some of my favorite Linux data/system recovery distributions include:
·         Trinity Rescue Kit
·         Knoppix
·         Ultimate Boot CD.

Individual rescue tools

Once you get beyond a full-blown distribution, you start looking at purpose-driven tools geared toward recovering data. Linux has just about any tool you need for this task. Let’s take a look at some of them.
Ddrescue
If you’re looking for the command line tool that will copy data from one file or block device to another, it’s Ddrescue that you need. There are a few things you should know about using the Ddrescue:
·         Never use this tool on a read/write mounted drive or partition.
·         Do not try to repair a file system with I/O errors.
·         Destination will be overwritten ─ so make sure destination is free of important data.
This tool is great for recovering data from a failing drive to an external source. You would first need to install the tool on your working system, attach both the failing drive and a destination drive, via USB, and use the tool to extract the necessary data.
Installing the tool on an Ubuntu system can be done with a single command:
sudo apt-get install gddrescue
The command structure of Ddrescue is:
ddrescue [options] infile outfile [logfile]
Let’s use Ddrescue to copy a partition from drive /dev/sdg to drive /dev/sdb. The command (run on a system that works with sudo) would look like:
sudo ddrescue /dev/sdg /dev/sdb
The above command would copy everything from the failing source to the healthy target. Data recovered!
Testdisk
This particular data recovery tool doesn’t actually try to copy data. Instead it attempts to correct partition-level issues that might be preventing you from accessing or recovering your data. Testdisk can:
·         Recover lost partitions
·         Make disks bootable again
·         Fix a partition table
·         Restore the master boot record
·         Restore boot sectors
·         Restore filesystem tables
·         Undelete files from NTFS, FAT, exFAT, and ext2 filesystems
·         Copy files from deleted NTFS, FAT, exFAT, and ext2/3/4 filesystems.
Testdisk is an ncurses tool that runs within a terminal.
To install Testdisk on an Ubuntu system, issue the command:
sudo apt-get install testdisk
Run the tool with sudo testdisk and walk through the easy-to-use wizard for working with your externally attached drive.
Photorec
If you’re looking to recover lost files, photos, videos, etc. Photorec is what you want. This tool is part of Testdisk, so once you’ve installed Testdisk, Photorec is ready to serve. This particular tool completely ignores the file system and looks directly at the underlying data. This means, if your file system is damaged, there’s a chance the data can still be recovered.
To start Photorec, issue the command:
sudo photorec
The interface for Photorec is similar to that of Testdisk. As Photorec works, it will display, in real time, what types of files it has recovered.
You do want to make sure the destination partition has enough space to contain the rescued data (you can copy the data to internal storage or external storage).

Wednesday 15 August 2018

Linux Operating System Job Interview Questions Part 3





Top Job Interview Questions for Linux Professionals






See also:

Linux Interview Questions Part 1

Linux Interview Questions Part 2

Threat modeling for Penetration Testers Kali Linux

36) What are environmental variables?
Environmental variables are global settings that control the shell's function as well as that of other Linux programs. Another common term for environmental variables is global shell variables.

37) What are the different modes when using vi editor?
There are 3 modes under vi:- Command mode – this is the mode where you start in- Edit mode – this is the mode that allows you to do text editing- Ex mode – this is the mode wherein you interact with vi with instructions to process a file

38) Is it possible to use shortcuts for a long pathname?
Yes, there is. A feature known as filename expansion allows you do this using the TAB key. For example, if you have a path named /home/iceman/assignments directory, you would type as follows: /ho[tab]/ice[tab]/assi[tab] . This, however, assumes that the path is unique and that the shell you're using supports this feature.

39) What is redirection?
Redirection is the process of directing data from one output to another. It can also be used to direct an output as an input to another process.

40) What is grep command?
grep a search command that makes use of pattern-based searching. It makes use of options and parameters that are specified along with the command line and applies this pattern in searching the required file output.

41) What could be the problem when a command that was issued gave a different result from the last time it was used?
One highly possible reason for getting different results from what seems to be the same command has something to do with case sensitivity issues. Since Linux is case sensitive, a command that was previously used might have been entered in a different format from the present one. For example, to lists all files in the directory, you should type the command ls, and not LS. Typing LS will either result in an error message if there is no program by that exact name exist or may produce a different output if there is a program named LS that performs another function.

42) What are the contents of /usr/local?
It contains locally installed files. This directory matters in environments where files are stored on the network. Specifically, locally-installed files go to /usr/local/bin, /usr/local/lib, etc.). Another application of this directory is that it is used for software packages installed from source, or software not officially shipped with the distribution.

43) How do you terminate an ongoing process?

Every process in the system is identified by a unique process id or pid. Use the kill command followed by the pid to terminate that process. To terminate all process at once, use kill 0.

44) How do you insert comments in the command line prompt?
Comments are created by typing the # symbol before the actual comment text. This tells the shell to completely ignore what follows. For example "# This is just a comment that the shell will ignore."

45) What is command grouping and how does it work?
You can use parentheses to group commands. For example, if you want to send the current date and time along with the contents of a file named OUTPUT to a second file named MYDATES, you can apply command grouping as follows: (date cat OUTPUT) > MYDATES

46) How do you execute more than one command or program from a single command line entry?
You can combine several commands by separating each command or program using a semicolon symbol. For example, you can issue such a series of commands in a single entry:
ls –l cd .. ls –a MYWORK which is equivalent to 3 commands: ls -l cd.. ls -a MYWORK
**Note that this will be executed one after the other, in the order specified.

47) Write a command that will look for files with an extension "c", and has the occurrence of the string "apple" in it.
Answer:
 Find ./ -name "*.c" | xargs grep –i "apple"
48) Write a command that will display all .txt files, including its individual permission.
Answer:
ls -al *.txt

49) Write a command that will do the following:
-look for all files in the current and subsequent directories with an extension c,v
-strip the,v from the result (you can use sed command)
-use the result and use a grep command to search for all occurrences of the word ORANGE in the files.
Find ./ -name "*.c,v" | sed 's/,v//g' | xargs grep "ORANGE"

50) What, if anything, is wrong with each of the following commands?
a) ls -l-s
b) cat file1, file2
c) ls - s Factdir
Answers:
a) there should be space between the 2 options: ls -l -s
b) do not use commas to separate arguments: cat file1 file2
c) there should be no space between hyphen and option label: ls –s Factdir


51) What is the command to calculate the size of a folder?
To calculate the size of a folder uses the command du –sh folder1.

52) How can you find the status of a process?
Use the command
ps ux

53) How can you check the memory status?
You can use the command
free -m to display output in MB
free -g to display output in GB

54) Explain how to color the Git console?
To color the Git console, you can use the command git config—global color.ui auto. In the command, the color.ui variable sets the default value for a variable such as color.diff and color.grep.

55) How can you append one file to another in Linux?
To append one file to another in Linux you can use command cat file2 >> file 1. The operator >> appends the output of the named file or creates the file if it is not created. While another command cat file 1 file 2 > file 3 appends two or more files to one.

56) Explain how you can find a file using Terminal?
To find a file you have to use a command, find . –name "process.txt" . It will look for the current directory for a file called process.txt.

57) Explain how you can create a folder using Terminal?
To create a folder, you have to use command mkdir. It will be something like these: ~$ mkdir LinuxOS

58) Explain how you can view the text file using Terminal?
To view the text file, go to the specific folder where the text files are located by using the command cd and then type less filename.txt.

59) Explain how to enable curl on Ubuntu LAMP stack?
To enable curl on Ubuntu, first, install libcurl, once done use following command sudo/etc/init .d /apache2 restart or sudo service apache2 restart.

60) Explain how to enable root logging in Ubuntu?
The command which enables root logging is
#sudo sh-c 'echo "greater-show-manual-login=true" >>/etc/lightdm/lightdm.conf'

61) How can you run a Linux program in the background simultaneously when you start your Linux Server?
By using nohup. It will stop the process receiving the NOHUP signal and thus terminating it you log out of the program which was invoked with. & runs the process in the background.

Sunday 5 August 2018

Linux Operating System Job Interview Questions Part 2


Top Interview questions for Beginners & Linux Administrators



See also:
Linux Interview Questions Part 1
Threat modeling for Penetration Testers Kali Linux

16) How can you find out how much memory Linux is using?
From a command shell, use the "concatenate" command: cat /proc/meminfo for memory usage information. You should see a line starting something like Mem: 64655360, etc. This is the total memory Linux thinks it has available to use.
You can also use commands to find current memory usage:
free - m
vmstat
top
htop

17) What is a typical size for a swap partition under a Linux system?
The preferred size for a swap partition is twice the amount of physical memory available on the system. If this is not possible, then the minimum size should be the same as the amount of memory installed.

18) What are symbolic links?
Symbolic links act similarly to shortcuts in Windows. Such links point to programs, files or directories. It also allows you instant access to it without having to go directly to the entire pathname.

19) Does the Ctrl+Alt+Del key combination work on Linux?
Yes, it does. Just like Windows, you can use this key combination to perform a system restart. One difference is that you won't be getting any confirmation message and therefore, a reboot is immediate.

20) How do you refer to the parallel port where devices such as printers are connected?

Whereas under Windows you refer to the parallel port as the LPT port, under Linux you refer to it as /dev/lp . LPT1, LPT2 and LPT3 would therefore be referred to as /dev/lp0, /dev/lp1, or /dev/lp2 under Linux.

21) Are drives such as hard drive and floppy drives represented with drive letters?
No. In Linux, each drive and device have different designations. For example, floppy drives are referred to as /dev/fd0 and /dev/fd1. IDE/EIDE hard drives are referred to as /dev/hda, /dev/hdb, /dev/hdc, and so forth.

22) How do you change permissions under Linux?
Assuming you are the system administrator or the owner of a file or directory, you can grant permission using the chmod command. Use + symbol to add permission or – symbol to deny permission, along with any of the following letters: u (user), g (group), o (others), a (all), r (read), w (write) and x (execute). For example, the command chmod go+rw FILE1.TXT grants read and write access to the file FILE1.TXT, which is assigned to groups and others.

23) In Linux, what names are assigned to the different serial ports?
Serial ports are identified as /dev/ttyS0 to /dev/ttyS7. These are the equivalent names of COM1 to COM8 in Windows.

24) How do you access partitions under Linux?
Linux assigns numbers at the end of the drive identifier. For example, if the first IDE hard drive had three primary partitions, they would be named/numbered, /dev/hda1, /dev/hda2 and /dev/hda3.

25) What are hard links?
Hard links point directly to the physical file on disk, and not on the pathname. This means that if you rename or move the original file, the link will not break since the link is for the file itself, not the path where the file is located.

26) What is the maximum length for a filename under Linux?
Any filename can have a maximum of 255 characters. This limit does not include the path name, so therefore the entire pathname and filename could well exceed 255 characters.

27)What are filenames that are preceded by a dot?
In general, filenames that are preceded by a dot are hidden files. These files can be configuration files that hold important data or setup info. Setting these files as hidden makes it less likely to be accidentally deleted.

28) Explain virtual desktop.
This serves as an alternative to minimizing and maximizing different windows on the current desktop. Using virtual desktops can clear the desktop when you can open one or more programs. Rather than minimizing/restoring all those programs as needed, you can simply shuffle between virtual desktops with programs intact in each one.

29) How do you share a program across different virtual desktops under Linux?
To share a program across different virtual desktops, in the upper left-hand corner of a program window look for an icon that looks like a pushpin. Pressing this button will "pin" that application in place, making it appear in all virtual desktops, in the same position onscreen.

30) What does a nameless (empty) directory represent?
This empty directory name serves as the nameless base of the Linux file system. This serves as an attachment for all other directories, files, drives, and devices.

31) What is the pwd command?
The pwd command is short for print working directory command.
Example:
pwd
Output:
/home/guru99/myDir

32) What are daemons?
Daemons are services that provide several functions that may not be available under the base operating system. Its main task is to listen for service request and at the same time to act on these requests. After the service is done, it is then disconnected and waits for further requests.

33) How do you switch from one desktop environment to another, such as switching from KDE to Gnome?
Assuming you have these two environments installed, just log out from the graphical interface. Then at the login screen, type your login ID and password and choose which session type you wish to load. This choice will remain your default until you change it to something else.

34) What are the kinds of permissions under Linux?
There are 3 kinds of permissions under Linux:- Read: users may read the files or list the directory- Write: users may write to the file of new files to the directory- Execute: users may run the file or lookup a specific file within a directory.

35) How does case sensitivity affect the way you use commands?
When we talk about case sensitivity, commands are considered identical only if every character is encoded as is, including lowercase and uppercase letters. This means that CD, cd, and Cd are three different commands. Entering a command using uppercase letters, where it should be in lowercase, will produce different outputs.