How To Install Memcached on CentOS

Memcached is a high-performance caching system that is primarily used to speed up sites that rely on databases. It is an in-memory system for storing any data that could be from database calls or page requests. To read more about Memcached you can view the project wiki on github

Clean out the repository:

yum clean all

Make sure everything is to date:

yum -y update

Install memcached and libevent-devel:

yum -y install memcached libevent-devel

Verify the configuration

nano /etc/sysconfig/memcached

You should see the following configuration information:

PORT=”11211″
USER=”memcached”
MAXCONN=”1024″
CACHESIZE=”64″
OPTIONS=””

Start memcached:

systemctl start memcached

Make sure it persists on reboot:

systemctl enable memcached

To make sure it is running you can telnet to the port you ran it on and type stats

$ telnet localhost 11211
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
stats
STAT pid 6331
STAT uptime 43199874
STAT time 1500745928
STAT version 1.4.10
STAT libevent 1.4.13-stable
STAT pointer_size 64
STAT rusage_user 645.228910
STAT rusage_system 1121.041575
STAT curr_connections 10
STAT total_connections 11
STAT connection_structures 11
STAT reserved_fds 20
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 7
STAT bytes_written 0
STAT limit_maxbytes 1073741824
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT evictions 0
STAT reclaimed 0
END

That is it for installing memcached on CentOS.

Jul 24, 2017LinuxAdmin.io

Source

Kali Linux 2017.1 Installation on Oracle VirtualBox

Kali Linux 2017.1 Installation
Kali Linux 2017.1 Installation on Oracle VirtualBox

This video tutorial shows

Kali Linux 2017.1 installation

on Oracle VirtualBox step by step. This tutorial is also helpful to install Kali Linux 2017 on physical computer or laptop hardware. We also install

Guest Additions

on Kali Linux 2017 for better performance and usability features such as Automatic Resizing Guest Display, Shared Folder, Seamless Mode and Shared Clipboard, Improved Performance and Drag and Drop.

Kali Linux 2017.1 Installation Steps:

  1. Create Virtual Machine on Oracle VirtualBox
  2. Start Kali Linux Installation
  3. Install Guest Additions
  4. Test Guest Additions Features: Automatic Resizing Guest Display and Shared Clipboard

Installing Kali Linux 2017.1 on Oracle VirtualBox

Kali Linux 2017.1 New Features and Improvements

Kali Linux

is a Debian-based distribution which features several security and forensics tools. Kali Linux 2017.1 features drivers for RTL8812AU wireless chipsets, improved GPU support and there are now Azure and AWS images of Kali Linux for cloud instances.

Kali Linux 2017.1

brings with it a bunch of exciting updates and features. As with all new releases, you have the common denominator of updated packages, an updated kernel that provides more and better hardware support, as well as a slew of updated tools.

Kali Linux Website:

https://www.kali.org/

VirtualBox Guest Additions Features

The Guest Additions offer the following features below:

 

  1. Improved Video Support: While the virtual graphics card which VirtualBox emulates for any guest operating system provides all the basic features, the custom video drivers that are installed with the Guest Additions provide you with extra high and non-standard video modes as well as accelerated video performance.
  2. Mouse Pointer Integration: This provides with seamless mouse support. A special mouse driver would have to be installed in the guest OS, which would exchange information with the actual mouse driver on the host. The special mouse driver then allows users to control the guest mouse pointer.
  3. Time Synchronization: With the Guest Additions installed, VirtualBox can ensure that the guest’s system time is better synchronized with that of the host.
  4. Shared Folders: These provide an easy way to exchange files between the host and the guest.
  5. Seamless Windows: With this feature, the individual windows that are displayed on the desktop of the virtual machine can be mapped on the host’s desktop, as if the underlying application was actually running on the host.
  6. Shared Clipboard: With the Guest Additions installed, the clipboard of the guest operating system can optionally be shared with your host operating system.

Hope you found this Kali Linux 2017.1 installation on Oracle VirtualBox tutorial helpful and informative. Please consider sharing it. Your feedback and questions are welcome!

Source

CLI: Simple Guide To View Processes In Linux – NoobsLab

In this guide, we try to cover most part of processes and understand how to manage them on your Linux system. So when we execute a program it represents one or more processes, in order to make our system operations smooth, the management and control of processes is essential. Usually, processes on the Linux system will execute, live, and get killed without intervention from the user because kernel manage them automatically. However, there can be some cases when a process is executed and after sometime the process can die for some unknown reason and it needs a restart to get the work done. Or a process may run fiercely and consume lots of system resources, in such case requiring a termination. We may need a instruct running process to perform certain operation, such as rereading a configuration file.

How a process works: When Linux system boots up, the kernel executes some of its own processes, basically, runs series of shell scripts to make system ready to use. Many of these processes are implemented as daemon processes, processes that just sit in the background and perform their task without having any interaction with user. So even you are just boot up the system and don’t log-in, the system is little busy performing routine jobs.

The kernel of the system maintains information of each process executed to keep system well organized. For instance, when a process is executed a number called PID (process ID) assigned to it. PID (process ID) are always assigned in ascending order. The kernel also helps keep track of system memory assigned to each process, as well as those processes’ ready to resume their execution.

Lets follow the guide, how to manage processes on your system:

Viewing Processes with “PS”

PS – this command can be used to get the information about running processes. There are almost 80 options available for ps command, we will cover some combinations of them.

Run this command in your system to display the processes information:

ps

To view processes by the your logged-in user:

ps -ux

View processes by user ‘noobslab’:

ps -U noobslab

View processes by program name:

ps -C gnome

View particular process by PID:

ps -p1,2,18076

View more refined output of ps using grep:

ps -ux | grep gnome
ps aux | grep gnome
ps auxw | grep gnome

It shows every running process with details:

ps aux

Displays all processes in a threaded view, with parent/child process hierarchy and session IDs:

ps -ejH

View processes hierarchy in BSD-style:

ps axjf

If you want to dive more into PS command then check manual using this command:

man ps

 

Viewing Processes with “PSTREE”

PSTREE – It is used to display the hierarchical list of processes in tree format. It is very useful for understanding the parent/child processes relationship.

Run this command in your system to display the processes in tree format:

pstree

Display processes tree including PID:

pstree -p

for more options check manual:

man pstree

Viewing Processes with “TOP”

TOP – This command is similar to ps but it displays continuous updated results. It is very useful when you need to keep an eye on one or more processes to check how they are performing and consuming resources. In addition, it displays CPU-intensive process at the top (displaying processes using CPU from higher to lower). Further more, we can use this command with other options to get expected results.

You can run this command in your system to get processes information:

top

Display processes with delay of 1 second (default 3 seconds):

top -d 1

Display processes of a user:

top -u noobslab

Display processes using PID:

top -p 1,2,18076,18092

It runs ‘top’ command for sometime and log output in the file:

top -b -n 1000 > processes_log.txt

To know more options for TOP run this command:

man top

Viewing Processes with “PGREP”

PGREP – It lets you look up the process and get the information about the process

Run this command to display the process information:

pgrep -l gnome

Run this command to list all processes by user:

pgrep -lu noobslab

You can get more information using this command:

man pgrep

Beside these popular command utilities, do you use anything else? Let everybody know in the comment below!

Source

Weekend Reading: Tor and Tails

Tails is a live media Linux distro designed to boot into a highly secure desktop environment. Tor is a browser that prevents somebody watching your internet connection from learning what sites you visit, and it prevents the sites you visit from learning your physical location.

Learn why anonymity matters and how you can protect yourself with this Linux Journal Weekend Reading.

Tor Hidden Services

Why should clients get all the privacy? Give your servers some privacy too!

Tails above the Rest: the Installation

How to get and validate the Tails distribution and install it. We will follow up with what Tails can and can’t do to protect your privacy, and how to use Tails in a way that minimizes your risk. Then we will finish with some more advanced features of Tails, including the use of a persistent volume (with this feature, depending on your needs, you could conceivably use Tails as your main Linux distribution).

Tails above the Rest, Part II

Now that you have Tails installed, let’s start using it. Read on to find out how to get started.

Tails above the Rest, Part III

In the first two parts on this series, we gave an overview of Tails, including how to get the distribution securely, and once you have it, how to use some of the basic tools. Here, we cover some of the more advanced features of Tails, such as some of its log-in options, its suite of encryption tools and the persistent disk.

Tor Security for Android and Desktop Linux

The Tor Project presents an effective countermeasure against hostile and disingenuous carriers and ISPs that, on a properly rooted and capable Android device or Linux system, can force all network traffic through Tor encrypted entry points (guard nodes) with custom rules for iptables. This action renders all device network activity opaque to the upstream carrier—barring exceptional intervention, all efforts to track a user are afterwards futile.

A Bundle of Tor

The best way to set up Tor on your personal machine.

Dolphins in the NSA Dragnet

As we mentioned in “NSA: Linux Journal is an ‘extremist forum’ and its readers get flagged for extra surveillance”, the NSA has been flagging certain Internet traffic as extremist based on specific patterns.

Source

Intel Core i9 9900K vs. AMD Ryzen 7 2700X Linux Gaming Benchmarks

Intel Core i9 9900K vs. AMD Ryzen 7 2700X Linux Gaming Benchmarks

Complementing the just-published Intel Core i9 9900K Linux benchmarks with the launch-day embargo lift are the Linux gaming benchmarks… This article is looking at the Linux performance between the Core i9 9900K and AMD’s Ryzen 7 2700X in a variety of native Linux games as well as comparing the performance-per-Watt. So if you are a Linux gamer and deciding between these sub-$500 processors, this article is for you.

 

 

If you didn’t yet read the main article that features a 15-way CPU comparison on Ubuntu 18.10 with the Linux 4.19 kernel, here is a recap of this new Coffeelake refresh CPU. The Core i9 9900K is an eight-core / sixteen-thread processor with 3.6GHz base frequency and 5.0GHz turbo frequency. This 14nm CPU has a 16MB L3 cache, dual channel DDR4-2666 support, and a 95 Watt TDP. There is also the onboard UHD Graphics 630, but if you’re a gamer, that isn’t going to cut it. The Core i9 9900K is launching at $499 USD.

 

At least until AMD introduces a Ryzen 7 2800X, the closest competition they have is with the Ryzen 7 2700X. The AMD Ryzen 7 2700X is eight cores / sixteen threads and also a 16MB L3 cache but where it differs is having a 3.7GHz base clock (+100MHz), 4.3GHz boost clock (-700MHz compared to the i9-9900K), 12nm FinFET (compared to Intel’s 14nm), and a 105 Watt TDP (+10 Watts). But the Ryzen 7 2700X retails for just over $300 USD and also includes the Wraith Prism heatsink fan while the i9-9900K at $499 does not include a stock heatsink, further upping its cost. But for my Core i9 9900K I have been using an Arctic Cooling Freezer 12 that retails for about $20 USD since we don’t focus on overclocking and this Arctic i11/12 heatsinks work out well and also comply with 4U height requirements for the racked up systems.

 

 

For these benchmarks both systems were tested with a Radeon RX Vega 64 8GB given the popularity of Radeon graphics by Linux gamers given the open-source driver stack being a boon these days thanks to AMD, Valve, and other contributors, The RX Vega 64 was using the Linux 4.18 kernel and Mesa 18.2.2 built against LLVM 7.0 as shipped by Ubuntu 18.10.

 

Both systems were running with 2 x 8GB DDR4-3200 memory, ASUS motherboards, Samsung 970 EVO NVMe SSD while the Steam game collection is on a Crucial MX300 525GB SATA 3.0 SSD, and running with the other default Ubuntu 18.10 software components. Both systems were running with the latest BIOS/microcode releases and all relevant CPU speculative execution mitigations.

 

A variety of Linux-native games were carried out for this comparison using the Phoronix Test Suite. Rather than just running the games at low resolutions and low quality settings in order to be CPU bound, this testing was focused on being more real-world to Linux gamers and thus tested at a variety of modern resolutions and quality settings.

As usual, each CPU was tested at its default frequencies… With the case of the auto-generated system table it just comes down to a difference in the CPU frequency scaling driver reporting a base vs. turbo clock speed difference for the number reported. Both systems were also using their “performance” CPU frequency scaling governor.

The impact of Linux games on the CPU tend to have different impact on processors than Windows games due to many of the premiere games being ported over from Windows and often wrapped around various Direct3D to Vulkan (or OpenGL, for the older games) and other porting layers. There is also the matter that most Linux native games that are considered “current” tend to be out months if not years later than the Windows release — such as the Rise of the Tomb Raider Linux port having just come out earlier this year by Feral.

 

Not focused in this round of testing are any Steam Play / Proton / Wine games but those tests will be coming soon now that Steam Play / DXVK has matured enough and should begin handling some of the more graphically interesting and benchmark-friendly Windows games.

 

 

During these benchmarks the Phoronix Test Suite was monitoring the system’s AC power consumption in real-time (interfacing with a WattsUp Pro power meter) and automatically generating performance-per-Watt metrics. Thanks again to Intel for sending over the Core i9 9900K review sample and ASUS for supplying the PRIME Z390-A motherboard that has been working out great with i9-9900K testing the past two weeks.

 

Source

how to install and configure aws cli on linux ?

AWS Command Line Interface (CLI). Depending on your operating system ways are different for installation. I will show you installation of AWS CLI on Ubuntu and CentOS Linux OS.

Install AWS Command Line Interface ( CLI)

Install AWS CLI in Ubuntu Linux

Pip is recommended method of installing AWS CLI on Linux which is python based tool helps in install, upgrade, and remove Python packages.

– Install python-pip package using apt-get

[root@linuxforfreshers~] apt-get install python-pip

Install AWS CLI using pip command

[root@linuxforfreshers~] pip install awscli

You can configure it using “aws configure” command.

While configuring, it will ask you for the several information like AWS Access Key ID, AWS Secret Access Key, Default region name, Default output format. You need to provide that information. In my case below is the Access Key and Secret Access Key.

AWS Access Key = AKIAJRSF3SHFXWALVL2A

AWS Secret Access Key = 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

Let’s configure it using command.

[root@linuxforfreshers~] aws configure

AWS Access Key ID [None]: AKIAJRSF3SHFXWALVL2A

AWS Secret Access Key [None]: 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

Default region name [None]: us-east-1

Default output format [None]:

Once configuration complete, It will create .aws folder in user’s home directory. Below is the content of .aws directory.

[root@linuxforfreshers~] ls .aws/

[root@linuxforfreshers~] cat .aws/config

[root@linuxforfreshers~] cat .aws/credentials

aws_access_key_id = AKIAJRSF3SHFXWALVL2A

aws_secret_access_key = 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

– Now Test if AWS CLI is installed correctly or not.

[root@linuxforfreshers~] aws help

If you are given wrong access_key u will get following error.

An error occurred (InvalidAccessKeyId) when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our records.

– Check Version of AWS CLI.

[root@linuxforfreshers]aws –version

aws-cli/1.11.129 Python/2.7.6 Linux/4.4.0-59-generic botocore/1.5.92

Install AWS CLI in CentOS Linux

– Check if python is installed in your system or not. If not install it using below command.

[root@linuxforfreshers~]# yum -y install python

Download the installation script.

[root@linuxforfreshers~]# curl -O https://bootstrap.pypa.io/get-pip.py

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 1388k 100 1388k 0 0 205k 0 0:00:06 0:00:06 –:–:– 265k

[root@linuxforfreshers~]#

Run the script with Python.

[root@linuxforfreshers~]# python get-pip.py

Downloading pip-7.0.3-py2.py3-none-any.whl (1.1MB)

100% |████████████████████████████████| 1.1MB 155kB/s

Downloading wheel-0.24.0-py2.py3-none-any.whl (63kB)

100% |████████████████████████████████| 65kB 252kB/s

Collecting argparse (from wheel)

Downloading argparse-1.3.0-py2.py3-none-any.whl

Installing collected packages: pip, argparse, wheel

Successfully installed argparse-1.3.0 pip-7.0.3 wheel-0.24.0

[root@linuxforfreshers~]#

– Now install AWS command line using pip.

[root@linuxforfreshers~]# pip install awscli

– Let’s configure AWS CLI.

[root@linuxforfreshers~] aws configure

AWS Access Key ID [None]: AKIAJRSF3SHFXWALVL2A

AWS Secret Access Key [None]: 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

Default region name [None]: us-east-1

Default output format [None]:

– Verify either file and folder is created.

[root@linuxforfreshers~] ls .aws/

[root@linuxforfreshers~] cat .aws/config

[root@linuxforfreshers~] cat .aws/credentials

aws_access_key_id = AKIAJRSF3SHFXWALVL2A

aws_secret_access_key = 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

Installation is complete now and you can start using aws cli.

 

Source

How To Install NTPD On CentOS 7

Install And Configure NTPD

NTP (Network Time Protocol) is a protocol which allows computers to synchronize time. NTPd is a daemon that maintains the system time in synchronization with other NTP servers. This prevents drift which is the slow inconsistency of time on computers internal clocks. Keeping system time accurate is particularly important for system logs, replication, and applications.

Install NTPD

First you will want to install ntp, this is found in the default repostory

yum -y install ntp

CentOS 7 ships with chronyd as a default package, so you will want to disable that as well

Stop the service:

systemctl stop chronyd.service

Disable the service:

systemctl disable chronyd.service

Both chronyd and ntpd be used at the same time.

Configure NTP

You will then want to locate the closest timeservers to you you can find them here In this case we are going to leave the default servers that ship with the rpm

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

Adding or removing servers would be done in /etc/ntp.conf

Enable And Start NTP

You will then want to start the ntpd service

systemctl start ntpd

And make sure the service will start on reboot

systemctl enable ntpd

You will also want to allow ntp in the firewall

firewall-cmd –add-service=ntp –permanent

Then reload the firewall

firewall-cmd –reload

You can then verify it has is working correctly

# systemctl status ntpd
● ntpd.service – Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2017-07-31 13:27:12 EDT; 5min ago
Main PID: 810 (ntpd)
CGroup: /system.slice/ntpd.service
└─810 /usr/sbin/ntpd -u ntp:ntp -g

You are looking for the ‘active (running)’ statement. That is it for installing ntpd.

Performing A Manual NTP Sync

How to perform a manual update of the system clock with ntp

First stop the service to free up the port (123) to be used for the manual update:

systemctl stop ntpd

Run the update:

# ntpd -gq
ntpd: time slew +0.009586s

-g is to update the time no matter how much of a offset.
-q is to exit immediately after setting the time.

Regard ntpd service:

systemctl start ntpd

That is all that is required for a manual sync.

Jul 31, 2017LinuxAdmin.io

Source

Kali Linux 2017.1 KDE Plasma Installation on Oracle VirtualBox

Kali Linux 2017.1 KDE Plasma Installation
Kali Linux 2017.1 KDE Plasma Installation on Oracle VirtualBox

This video tutorial shows

Kali Linux 2017.1 KDE Plasma installation

on

Oracle VirtualBox

step by step. This tutorial is also helpful to install Kali Linux 2017 KDE on physical computer or laptop hardware. We also install

Guest Additions

on Kali Linux 2017 for better performance and usability features such as Automatic Resizing Guest Display, Shared Folder, Seamless Mode and Shared Clipboard, Improved Performance and Drag and Drop.

 

Kali Linux 2017.1 KDE Installation Steps:

  1. Create Virtual Machine on Oracle VirtualBox
  2. Start Kali Linux KDE Installation
  3. Install Guest Additions
  4. Test Guest Additions Features: Automatic Resizing Guest Display and Shared Clipboard

Installing Kali Linux 2017.1 KDE on Oracle VirtualBox

 

Kali Linux 2017.1 New Features and Improvements

Kali Linux

is a Debian-based distribution which features several security and forensics tools. Kali Linux 2017.1 features drivers for RTL8812AU wireless chipsets, improved GPU support and there are now Azure and AWS images of Kali Linux for cloud instances.

Kali Linux 2017.1

brings with it a bunch of exciting updates and features. As with all new releases, you have the common denominator of updated packages, an updated kernel that provides more and better hardware support, as well as a slew of updated tools.

Kali Linux Website:

https://www.kali.org/

What is KDE Desktop?

The KDE Community is an international technology team dedicated to creating a free and user-friendly computing experience, offering an advanced graphical desktop, a wide variety of applications for communication, work, education and entertainment and a platform to easily build new applications upon. In this regard, the resources provided by KDE make it a central development hub and home for many popular applications and projects like Calligra Suite, Krita, digiKam, and many others.

KDE Website:

https://www.kde.org/

VirtualBox Guest Additions Features

The Guest Additions offer the following features below:

 

  1. Improved Video Support: While the virtual graphics card which VirtualBox emulates for any guest operating system provides all the basic features, the custom video drivers that are installed with the Guest Additions provide you with extra high and non-standard video modes as well as accelerated video performance.
  2. Mouse Pointer Integration: This provides with seamless mouse support. A special mouse driver would have to be installed in the guest OS, which would exchange information with the actual mouse driver on the host. The special mouse driver then allows users to control the guest mouse pointer.
  3. Time Synchronization: With the Guest Additions installed, VirtualBox can ensure that the guest’s system time is better synchronized with that of the host.
  4. Shared Folders: These provide an easy way to exchange files between the host and the guest.
  5. Seamless Windows: With this feature, the individual windows that are displayed on the desktop of the virtual machine can be mapped on the host’s desktop, as if the underlying application was actually running on the host.
  6. Shared Clipboard: With the Guest Additions installed, the clipboard of the guest operating system can optionally be shared with your host operating system.

Hope you found this Kali Linux 2017.1 KDE Plasma installation on Oracle VirtualBox tutorial helpful and informative. Please consider sharing it. Your feedback and questions are welcome!

Source

How to Create a Symbolic Link on Ubuntu

In Linux, there are lots of powerful features that can make the life a lot easier. Linking is one of them that can allow you to perform your tasks a lot faster and more efficiently. You did hear the name “symbolic link”, or more common “symlink”, right? It’s a feature that allows linking to a physical directory or file.

For servers, symlinking is very useful. Are you a Linux user? Then symlink can also help you a lot. All you have to do is be creative with it to lessen your workload.

There are a lot of complex directories in the file system of Linux, right? Remembering all of them can be a real hassle. Moreover, when you want to work with a file/directory that’s deep within directories and sub-directories, the file path length becomes longer.

It’s especially a pain when working with CLI where you have to specify the file paths. Here comes the symlink to help.

For example, you want to access “/home/<username>/Downloads/a/b/c/d/e.txt” file. This is an easy demo, but surely typing the entire file length isn’t something you want to do often, right? With the power of symlink, you can dramatically reduce the file path to “/home/e.txt”.

Here, the symlink feature allows you create a virtual file at “/home/e.txt” that indicates to the “/home/<username>/Downloads/a/b/c/d/e.txt”. Whenever you ask for “/home/e.txt” file to manipulate, the system will work on the original file.

The same method goes for directories as well.

Today, let’s check out all how to create a symlink and have fun with it.

Creating Symlink

On all the Linux systems, there’s a tool “ln”. Don’t confuse with natural logarithm! “ln” follows the same structure of “cp” and “mv”. Learn more about copying file(s) and directories on Linux.

ln -s <source_file_directory> <link_file_directory>

For example, let’s create a symlink of “/home/viktor/Downloads” to “/Downloads”.

sudo ln -s /home/viktor/Downloads /Downloads

It’s time to verify the result. Note that you can easily verify the result with a command that works using that directory or file. For example,

I’m now inside “/Downloads” directory. It’s actually not a new directory. Instead, it’s a link to the original “/home/viktor/Downloads” folder.

Verify that both are the same –

cd /home/viktor/Downloads

ls

cd /Downloads

ls

See? Both of them are the same!

Let’s do the same with a file. I have already set a demo file “pimusic.txt” on “/home/viktor/Desktop”. Let’s link it as “PIMUSIC”.

sudo ln -s /home/viktor/Desktop/pimusic.txt PIMUSIC

Verify the result –

Creating permanent symlink

Note that the symlinks you create aren’t permanent. Whenever you reboot your system, you have to recreate the symlink again. To make them permanent, simply remove the “-s” flag. Note that it will create a HARD LINK.

sudo ln /home/viktor/Desktop/pimusic.txt PIMUSIC

Verify the result after rebooting the system –

Enjoy!

Source

Networking Basics – IP address, netmasks and subnets

In this tutorial, we will cover some networking basics. We won’t be hacking anything, but by the end of the tutorial you’ll learn a lot of things which will be useful later, especially when you’ll use nmap. Please note that it is advised that you go through wikipedia pages of all the concepts covered here since the discussion won’t be exhaustive in any way.

IP address

An IP address is simply a 32 bit address that every device on any network (which uses IP/TCP protocol) must have. It is usually expressed in the decimal notation instead of binary because it is less tedious to write it that way. For example,
Decimal notation – 192.168.1.1

Binary – 11000000.10101000.00000001.00000001It is clear from the binary form that the IP is indeed 32 bits. It can range from 0.0.0.0 to 255.255.255.255 (for the binary all 0s and all 1s respectively) [A lot of time, the first octet usually goes upto 127 only. However, we aren’t concerned with that here.]

 

Parts of an IP address

Now this IP address has 2 parts, the network address and host address. A lot of wireless routers keep the first 3 octets (8 bits, hence octets) for the network address and the last octet as host address. A very common configuration being 192.168.1.1 . Here, 192.168.1.0 is the network address and 0.0.0.1 is host address. I hope you can see that the host address can vary from 0.0.0.0 to 0.0.0.255 (though usually 0 and 255 are reserved for the network and broadcast respectively).



Need for Netmasks

But different networks have different needs. The previous configuration lets you have a lot of different possible networks (the first 3 octets are for the network and can take different values, not just 192.168.1.0) but only 256 (254 actually) hosts. Some networks may want more hosts (more than 255 hosts per network). This is why there is no “hardcoded” standard enforced on networks for the network and host addresses, and instead, they can specify their own configuration. The first 3 octets being network address and last octet being host address is common, but in no way mandatory. Using Netmasks, we can have very versatile set of configurations, for each and every need.

Netmask

A netmask is used to divide the IP address in subnets.

We’ll start with a basic example. Suppose we want to define a netmask which configures our network like wireless router in the previous example. We want the first 3 octets to correspond to the network and next 1 octet for host address. Let’s think of an operation which we can use to separate the network and host part of the IP address. For simple purposes, we could have just defined after which octet does the host part start [basically saying that anything after the third period(.) is host address]. While this is a simple solution, it is not very versatile. A more elegant and mathematical solution was proposed.

Netmask – Working

First I’ll tell you the mathematical functionality of a netmask. Assume A to be an IP address and M to be a netmask. Then,

A & M gives the Network addressA & (~M) gives the Host address.Where,& is bitwise And~ is bitwise Not (i.e. complement, 1s complement to be more precise)So, basically a netmask is another 32 bit binary number (just like an IP address), but with the purpose of giving Host address and network address when the operation bitwise and is carried out on it (and it’s complement) with A.

 

Example

You’ll understand better with example.

A = 192.168.1.1 is you IP addressM = 255.255.255.0We convert it to binary, and then carry out the desired operations.

A = 11000000.10101000.00000001.00000001 (192.168.1.1)

M = 11111111.11111111.11111111.00000000 (255.255.255.0)A&M = 11000000.10101000.00000001.00000000 (192.168.1.0)A&M is network IP that we desired
A = 11000000.10101000.00000001.00000001 (192.168.1.1)

~M = 00000000.00000000.00000000.11111111 (0.0.0.255)A&~M= 00000000.00000000.00000000.00000001 (0.0.0.1)A&~M is host IP that we desired

 

Explanation

Basically, if you realize that 11111111 is 255 in decimal, then you can see that for the parts of the IP address that you want for networks, you set the subnet to 255, and for the ones you want for host, you set it to 0.

So, if you want to reserve 2 octets for networks and 2 for hosts, then the subnet will be-M = 255.255.0.0If you want 3 octets for host, thenM = 255.0.0.0
Hence, we can see that using netmasks we can achieve what we wanted, i.e. to define networks with whatever number of hosts we require. Now we go a bit further.

 

Subnets

Now suppose you want to divide your network into parts. It is the sub-networks that are known as subnets (it is correct to call them subnetwork as well).

We’ll jump right to it, consider the netmask MM = 11111111.11111111.11111111.11000000Now, the first 3 octets describe the network. But the 4th octet, which is supposed to be for the host, has the 2 most significant bits (i.e. leftmost bits) as 1. Thus, the 2 most significant (leftmost) bits of the 4th octet will show up when we carry out the bitwise AND operation. They will, thus, be a part of the network address. However, they belong to the host octet. Thus, these 2 bits, which belong to the host octet but show up in the network IP address divide the network into subnets. The 2 bits can represent 4 possible combinations, 00, 01, 10 and 11, and hence the network will have 4 subnets.

 

Example of Subnetwork

Back to our previous “A”,

A = 11000000.10101000.00000001.xx000001 (192.168.1.1)M = 11111111.11111111.11111111.11000000 (255.255.255.192)A&M = 11000000.10101000.00000001.xx000000 (192.168.1.0)

Earlier, irrespective of what was there in 4th octet of A, we would have got all 0s in 4th octet of A&M i.e. network address. This time we will get the 2 most significant bits in the network address. Four subnets will be formed depending on the value of xx (which can be 00,01,10 or 11). Now, we will see which subnet has which set of hosts.

 

Which subnet has which hosts

11000000.10101000.00000001.00000000

has hosts 192.168.1.0-63 (00000000 to 00111111)
11000000.10101000.00000001.01000000

has hosts 192.168.1.64-127 (01000000 to 01111111)
11000000.10101000.00000001.10000000

has host 192.168.1.128-191 (10000000 to 10111111)
11000000.10101000.00000001.11000000

has host 192.168.1.192-255 (11000000 to 11111111)
So the netmask M divided the network into 4 equal subnets with 64 hosts each. There are some subnets which are much more complicated and have their applications in certain specific areas. I recommend going through Wikipedia page on Subnetworks to get some more idea. I have covered enough and now you can understand Wikipedia;s content on the topic without any difficulty.

 

Some Special IPs

0.0.0.0 = All IPs on local machine. Anything hosted on this IP is available to all devices on the network.

127.0.0.1 = LocalHost, this loops back to the machine itself.

255.255.255.255 = Broadcast, anything sent to this IP is broadcasted (like radio is broadcasted to everyone) to all hosts on the network.

Finally

You see the notation in this pic?

This way of representing subnets using /24, /25, /26, etc. is quite useful while doing vulnerability scans on networks (using nmap, etc.). /24 represents the netmask 255.255.255.0 , the first example we took of Wireless router. It is the most common configuration you’ll use while doing nmap scan. The one we discussed later, in the subnets section, is /26. It has 4 subnetworks. /25 has 2 subnets. /27 has 8. /31 has 128 subnets! In this subnet, only 2 host can be there per network, and it is used for 1 to 1 or point to point links. I hope the next time you have to deal with networks, you won’t be having difficulties. There are topic like Multicast etc. which build up on this, and you can do further reading on them. That was all for this tutorial. Good luck.

Source

WP2Social Auto Publish Powered By : XYZScripts.com