How To Add Swap On Linux

Swap is a type of filesystem and is a virtual memory. Whenever your RAM is full, your operating system will look for further memory in your swap space. For this reason, you reserve some part of the hard disk to create a swap partition.


Identifying Current Swap Space Usage

[[email protected] ~]# cat /proc/swaps
Filename          Type          Size          Used        Priority 
/dev/sda7     partition        1951740         4                -1

Alternatively, use the swapon command:

[[email protected] ~]# swapon -s
Filename            Type           Size          Used      Priority
/dev/sda7          partition      1951740           4            -1

Finally, the free command may also be used:

[[email protected] ~]# free
                      total       used           free     shared     buffers     cached
Mem:            895112     721656    173456      0         36592      310156
-/+ buffers/cache:         374908    520204
Swap:           1952736         4    1952732

Adding a Swap File

Additional swap may be quickly added to the system by creating a file and assigning it as swap. This is achieved as follows. The following dd command example creates a swap file with the name swap with a size of 1Gb.

Create the swap file using the dd command:

[[email protected] ~]# dd if=/dev/zero of=/swap bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 17.4283 s, 61.6 MB/s

Configure the file as swap

Change the permission of the swap file so that only root can access it

[[email protected] ~]# chmod 600 /root/swap

[[email protected] ~]# mkswap /swap
 Setting up swapspace version 1, size = 1048572 KiB
 Enable the newly created swapfile :

[[email protected] ~]# swapon /swap

Finally, modify the /etc/fstab file to automatically add the new swap at system boot time by adding the following line:

# cat /etc/fstab
/swap    none    swap    sw    0 0

Once the swap space has been activated, verify that it is in use using the swapon –s command:

[[email protected] ~]# swapon -s
Filename      Type        Size       Used    Priority
/dev/sda7    partition   1951740  142884      -1
/swap            file         1048572       0         -2
[[email protected] ~]# free -k
                 total       used       free      shared       buffers      cached
Mem:        895112     828484      66628          0        2144        539552
-/+ buffers/cache:     286788      608324
Swap:       3000312    142876      2857436

If you don’t want to reboot to verify whether the system takes all the swap space mentioned in the /etc/fstab, use following to enable or disable swap.

[[email protected] ~]# swapoff -a
[[email protected] ~]# swapon -a

De-activate the additional swap space at any time using the swapoff command as follows:


[[email protected] ~]# swapoff /newswap

Some Useful Linux Screenshot Tools

Hi guys,

There are many Linux screenshot tools out there, so I decided to compile a list with some of the tools I have used and have experience with. The following tools are free and they will help you to capture your computer screen. In this list you will find all kinds of screenshot apps for Linux, from simple to advanced ones such as shutter.


I cannot hide the fact that this is one of my favorite apps for taking screenshots on my Linux machine. In my opinion, it is a must for every Linux technical blogger that want to craft nice pictures for his/her articles.

Shutter is an open source advanced screenshot app that can take a screenshot of a specific area, window, your whole screen, or even of a website. One of many reasons that I like to use it is the fact that the shutter has an editor which can be used to modify and apply effects to my screenshots.

After you have captured your screen you can use the shutter’s editor to add text, arrows, rectangles, ellipses, auto-increment shapes and apply many nice effects to your screenshot.

I am very happy that such a tool exists. It makes my job easier and my screenshots look good.  You can learn how to take and edit screenshots with shutter here.


HotShots is an application for capturing screens and saving them in a variety of image formats as well as adding annotations and graphical data (arrows, lines, texts,…). You can also upload your creations to the web (FTP/some web services).

For installation and usage instructions, please visit our previous article here.


Gnome-Screenshot is the best tool for taking screenshots in a very fast way. It is very simple to use, has a very nice looking user interface and the right features needed to capture computer screen. This tool was part of the gnome-utils package, but was split into its own package in 2011.

Unlike shutter, Gnome-Screenshot does not have an editor, but you can still apply some effects such as  Drop Shadow and Border. If you are looking for a very simple tool that does the job the use Gnome-Screenshot.

Gnome-Screenshot can be used to grab the whole desktop, grab the current window or select an area to grab. You can also  take a screenshot after a delay of seconds which you can specify with the Grab after a delay of option.

The good thing is that Gnome-Screenshot comes installed by default in Ubuntu Linux operating system. You can find and launch it by going to Applications, Accessories, Screenshot.


gpe-screenshot is a screenshot application for GPE and one of the simplest app I have ever used in my all Linux life. On debian based systems it can be installed via the apt-get command like shown below.

sudo apt-get install gpe-screenshot

Unfortunately, this screenshot app does not have many options and you can’t do much with it. It takes a screenshot of your whole computer screen and can save it locally or upload to

After the installation is finished, you can easily launch the gpe-screenshot application by going to Applications, Graphics and thenTake Screenshot.

The app will capture your computer screen immediately after its launch and after will ask you if you want to save it in any of the local folders on your machine or upload it to

The gpe-screenshot tool can be very useful when you want to share your screenshots with friends or want to show something to other people in online forums.


Ksnapshot is another useful screen capture app, with many useful features such as Snapshot delaySeveral Capture Modes and simple effects. It does not include an editor, but allows you to send your screenshots to image viewers and image editors such asGimp.

Ksnapshot has the following capture modes:

- Full Screen
– Freehand Region
– Window Under Cursor
– Section Of Window
– Rectangular Region


You learned about five screenshot tools, their features and options. Use the screenshot app that does the job for you. For me,shutter is the best, it does not mean it should be the same for you.


I take screenshots, edit them and share them in articles to my unixmen readers. Most of the time I use the shutter screen capture app, but sometimes I find myself using the Gnome-Screenshot tool.

Why Should You Put Linux In Your Computer

My life has changed quite alot since the day I switched to Ubuntu, a friendly Linux distribution with more than twenty million users around the world. I feel smarter, stronger and I am happier than ever before. At the beginning, it wasn’t easy, instead it was very hard.

The first thing that came into my mind after I did a fresh installation of Ubuntu Linux was: how am I going to use this thing that I have never seen before in my life  and have absolutely no idea what it is.

To be honest with you guys when I first started using Linux I did not even know how to delete files and was very careful in every action or mouse click I made.

I was used to Recycle Bin on my old Windows machine and never heard about Trash before. I started digging information into websites and asking in forums how to delete files in Linux.

Many answers popped up!

Oww!!! It was amazing! It was my first day using Linux and I was surprised by the amount of Linux users that were trying to help me for free until I had a solution in my hands.

Linux Has a Great Community

So the first reason that you should take in consideration when thinking to switch to Linux or not, is the great and warm community that Linux has. Computer geeks, creators and builders from all over the world contribute their energy to build better open sourcesoftware, Linux distributions for everyone and for any kind of machine you can can name in planet earth and what it most important these guys work to find new efficient cheap solutions.

I am very sure that if you start using Linux you will feel a freedom that it was missing before and you had no idea that such thing existed.

Linux is freedom!

Someone writes blogs and Linux tutorials to help, someone writes shell scripts so others can use to make their life easier and some stay online on IRC channels to answer your questions about Linux.

If you have a problem with your Linux machine, chances are that it will be solved very fast. We will help you, they will help you, everybody in the Linux community is contributing in his/her own way.

You Can Use Linux From GUI

The first thing most of the people think when they heard the word Linux is the terminal, a tool that only weird geeks and nerds that live in their basement with their computers can use.

Of course that the command line is a powerful tool and learning it is a skill that everyone admires, but it is completely not true anddesinformative  that you need to know commands in order to use a Linux distribution.

“Don’t try Linux!” “It is scary, only geeks use it!” “You have to learn a ton of crazy commands to work on that operating system.” “These people install software by typing commands in their machines, are they crazy?”

That’s what people would say to you. But, I do not blame them because they have been left in a dark, they have been used to it and they hate the light.

They have no idea about Linux, so how can we expect from the to like it if they have never or seen tried it? We as Linux people, contributors and builders should help them understand Linux and teach them Linux.

I am thinking to teach Linux to my little sister. It is also a very good idea to teach Linux to kids, because they are the future of this world. To me, a world with more Linux people means a better world.

To use a Linux distribution, you don’t need to know anything about commands and terminals. If you do it is ok, it does not hurt anyone, instead it helps you alot.

You can use Linux like you use any operating system that has a graphical user interface. You have a mouse, you can do single clicks and double clicks. Like in Windows guys!

Am I clear enough, or should I continue to explain and give you more arguments that you don’t have to be some type of computer nerd or crazy to use Linux?

Linux Is Open Source And Free

What does the fact that Linux is open source mean? It means that its code is distributed so everyone can see, use, modify for his/her own use and projects and share with others.

I feel safe to use Linux because people cannot hide backdoors on it to spy my data and invade my privacy. Everything is open, everyone can see it.

If someone tries to put a backdoor in Linux, people will learn about it, but can you say the same for Mac OS X  or Windows operating system?

I am not trying to say that they have backdoord, I am just saying that their code is closed. Maybe it is ok for you because it seems very technical to know such thing, but believe me it is not.

It is not about Linux or windows,  it is about your freedom. Read more about Linux,  get a fresh Linux distro on the internet and take your freedom back again.

Note: I have nothing against Windows or Mac OS X because I am a computer geek and an explorer so I like to use them. But when it comes to freedom I choose Linux.

Do you know what the best part is? You don’t have to pay a dollar to use a Linux distribution. Every Linux distribution I have tried is free and believe me there so many that you would need year to use them all.

There Is A Linux Distribution For Everyone

There are many specific Linux distributions available for download  that can help in many areas such educationeconomyserversand computer security.


1. Trisquel GNU/Linux

Trisquel GNU/Linux is a 100% libre Ubuntu-based Linux distribution. Its main purpose is to provide an operating system for varied audiences, including home and office users, educational institutions, multimedia workstations, etc.

2. Edubuntu

Edubuntu is a partner project of Ubuntu, a distribution suitable for classroom use. The aim is that an educator with limited technical knowledge and skill will be able to set up a computer lab, or establish an on-line learning environment, in an hour or less, and then administer that environment without having to become a fully-fledged Linux geek.

3. UberStudent

UberStudent is an Ubuntu-based distribution on a DVD designed for learning and teaching academic computing in the higher education and advanced secondary levels. UberStudent comes with software for everyday computing tasks, plus a core set of programs and features designed to teach and make easier the tasks and habits common to high-performing students of all academic disciplines.


1. SteamOS

SteamOS is a Debian-based Linux distribution designed to run Valve’s Steam and Steam games. It also provides a desktop mode (GNOME) which can run regular Linux applications. In addition to a stable Debian base, SteamOS features various third-party drivers and updated graphics stack, a newer Linux kernel with long-term support, and a custom graphics compositor designed to provide a seamless transition between Steam, its games and the SteamOS system overlay. The base operating system is open-source software, but the Steam client is proprietary.

2. LinuxConsole

LinuxConsole is an independently developed Linux live CD with different editions designed for desktops, servers, gaming consoles, and old computers. Its primary characteristics are easy installation, extensive choice of software in the form of modules, and excellent hardware detection.

Security And Penetration Testing

If you are interested in learning computer security and penetration testing, then you should check the following Linux distributions.

1. Kali Linux

Kali Linux (formerly known as BackTrack) is a Debian-based distribution with a collection of security and forensics tools. It features timely security updates, support for the ARM architecture, a choice of four popular desktop environments, and seamless upgrades to newer versions.

2. BackBox Linux

BackBox Linux is an Ubuntu-based distribution developed to perform penetration tests and security assessments. It is designed to be fast and easy to use. It provides a minimal yet complete desktop environment, thanks to its own software repositories, which are always updated to the latest stable versions of the most often used and best-known ethical hacking tools.


CAINE (Computer Aided INvestigative Environment) is an Ubuntu-based GNU/Linux live distribution created as a project of digital forensics. It offers a complete forensic environment that is organized to integrate existing software tools as software modules and to provide a friendly graphical interface. The main design objectives that CAINE aims to guarantee are: an interoperable environment that supports the digital investigator during the four phases of the digital investigation, a user-friendly graphical interface, and a semi-automated compilation of the final report.

4. Matriux

Matriux is a Debian-based security distribution designed for penetration testing and forensic investigations. Although it is primarily designed for security enthusiasts and professionals, it can also be used by any Linux user as a desktop system for day-to-day computing. Besides standard Debian software, Matriux also ships with an optimized GNOME desktop interface, over 300 open-source tools for penetration testing, and a custom-built Linux kernel.

5. Swift Linux

Swift Linux is a lightweight, Debian and Linux Mint-based distribution featuring the IceWM window manager. Compared to its parent, Swift Linux includes extra applications, such as BleachBit (a tool for freeing up space and clearing private information), the LibreOffice office suite, and a wide variety of forensic analysis and data recovery utilities.

6. NetSecL OS

NetSecL is a security-focused distribution and live DVD based on openSUSE (starting from version 3.0, previous versions were based on Slackware Linux). To improve the security aspect of the distribution, servers have been removed, incoming ports closed and services turned off. Additionally, several penetration tools have been included.

7. DEFT Linux

DEFT (Digital Evidence & Forensic Toolkit) is a customized distribution of the Ubuntu live Linux CD. It is an easy-to-use system that includes excellent hardware detection and some of the best open-source applications dedicated to incident response and computer forensics.

8. ForLEx

ForLEx is a lightweight Debian-based Linux live CD which boots into an LXDE desktop. The distribution’s primary goal is to provide several useful utilities for forensic analysis.

Old Computers

Do you have an old machine abandoned in the dust because you can not find the appropriate operating system to power it up and there is no software for it at all?

There are many small and light Linux distributions that can be used to give life to old computers. Tiny Core Linux is one of them. It is only 12 MB, runs entirely in memory and boots very quickly.

The followings are some Linux distributions that you can use in your old computers.

1. Puppy Linux

Puppy Linux is yet another Linux distribution. What’s different here is that Puppy is extraordinarily small, yet quite full-featured. Puppy boots into a ramdisk and, unlike live CD distributions that have to keep pulling stuff off the CD, it loads into RAM. This means that all applications start in the blink of an eye and respond to user input instantly. Puppy Linux has the ability to boot off a flash card or any USB memory device, CDROM, Zip disk or LS/120/240 Superdisk, floppy disks, internal hard drive. It can even use a multisession formatted CD-RW/DVD-RW to save everything back to the CD/DVD with no hard drive required at all.

2. CrunchBang Linux

CrunchBang Linux is a Debian-based distribution featuring the lightweight Openbox window manager and GTK+ applications. The distribution has been built from a minimal Debian system and customized to offer a good balance of speed and functionality. CrunchBang Linux is currently available as a live CD; however, the best performance is achieved by installing it to a hard disk.

3. Lubuntu

Lubuntu is a fast, lightweight and energy-saving variant of Ubuntu using the LXDE (Lightweight X11 Desktop Environment) desktop. It is intended to have low-resource system requirements and is designed primarily for netbooks, mobile devices and older PCs.

Software And Updates Are Free

Most of the software used in Linux distributions is free. There are many developers, fans and geeks that contribute their knowledge and skills through their code in open source and free tools for all Linux people.

It is the user that decides what kind of software should come installed by default with the Linux distribution and not the creator and the maintainers of it.

Linux people, discuss ideas about software and many other things in IRC channels, blogs, mail lists, forums, meetings and big conferences.

Being a student it is very hard to pay for software. And when it comes to updates it really hurts. They  are very important for your system security, software performance  and make the system cooler with new features.

Thanks to Linux I don’t have to pay for software and updates. And believe me it is freedom!


There are many other reasons why one should put Linux on his/her machine, but I think I gave enough reasons and nice arguments to people that have not heard about Linux before or have not tried it.

Linux Basics: du Command Usage

Today we will discuss about how to find or summarize the disk usage on Unix/Linux systems using the du command. du stands forDisk Usage. In this handy tutorial, let us see how to use du command in real time.


du [OPTION]... [FILE]...
du [OPTION]... --files0-from=F


Let us see some practical examples. In this tutorial, I will be using /home/sk/unixmen/ directory to test du command. The /home/sk/unixmen directory contains the following content.

$ ls /home/sk/unixmen/ Akon - So Blue.mp4 Senthilkumar_Resume.pdf sk.txt Ubuntu 13.10

1. Find Disk Usage with out any options

Entering the du command without any parameters will display following result.

$ du /home/sk/unixmen/

Sample output:

673800    /home/sk/unixmen/Ubuntu 13.10
679084    /home/sk/unixmen/

By default, du command displays the result in Kilobytes.

2. Display Disk Usage including all files and folders

As you see in the above result, If you execute du command without any parameters, it will display disk usage occupied by the directories only. So, If you want to find the disk usage of all files and directories, use -a flag.

$ du -a /home/sk/unixmen/

Sample output:

516    /home/sk/unixmen/
4672    /home/sk/unixmen/Akon - So Blue.mp4
0    /home/sk/unixmen/sk.txt
673796    /home/sk/unixmen/Ubuntu 13.10/ubuntu-13.10-server-i386.iso
673800    /home/sk/unixmen/Ubuntu 13.10
92    /home/sk/unixmen/Senthilkumar_Resume.pdf
679084    /home/sk/unixmen/

3. Display Disk Usage in human readable format

As you see in the above outputs, the disk usage size is shown as some random numbers (679084) which is difficult to understand the exact size, atleaset for beginners. So let us display the disk usage size in human readable format such as in KB, MB, GB etc.

To calculate the disk usage in human readable format, use -h flag.

$ du -ah /home/sk/unixmen/

Sample Output:

516K    /home/sk/unixmen/
4.6M    /home/sk/unixmen/Akon - So Blue.mp4
0    /home/sk/unixmen/sk.txt
659M    /home/sk/unixmen/Ubuntu 13.10/ubuntu-13.10-server-i386.iso
659M    /home/sk/unixmen/Ubuntu 13.10
92K    /home/sk/unixmen/Senthilkumar_Resume.pdf
664M    /home/sk/unixmen/

Now you can easily understand the disk usage sizes displayed in KB, MB, or GB format.

4. Display Disk Usage in MB or GB only

To display the disk usage of files and directories in Megabytes, or Gigabytes, use the parameter -B followed by M or G.

To display disk usage in Megabytes, enter the following command:

$ du -BM /home/sk/unixmen/

Sample output:

659M    /home/sk/unixmen/Ubuntu 13.10
664M    /home/sk/unixmen/

To display disk usage in Gigabytes, enter the following command:

$ du -BG /home/sk/unixmen/

Sample output:

1G    /home/sk/unixmen/Ubuntu 13.10
1G    /home/sk/unixmen/

5. Display Total Disk Usage

To display the total disk usage of files and directories, use -c option.

$ du -c /home/sk/unixmen/

Sample output:

673800    /home/sk/unixmen/Ubuntu 13.10
679084    /home/sk/unixmen/
679084    total

6. Display Total Disk Usage only

The previous command with -c option displays total size of the Disk Usage along with directories. If you want to skip all the results, and to display the total disk usage only, then use -s option.

$ du -s /home/sk/unixmen/

Sample output:

679084    /home/sk/unixmen/

To display the same result in human readable format, use -h option along with -s option.

$ du -sh /home/sk/unixmen/

Sample output:

664M    /home/sk/unixmen/

7. Display Disk Usage by excluding particular file types

Want to display the disk usage by excluding particular file types? For example, here we will summarize the disk usage result by excluding zip files.

$ du -h --exclude=*.zip* /home/sk/unixmen/

Sample output:

659M    /home/sk/unixmen/Ubuntu 13.10
663M    /home/sk/unixmen/

8. Display the Disk Usage by modification time

Do you want to display the disk usage by the modification time of files and directories? If yes, use –time option.

$ du -h --time /home/sk/unixmen/

Sample output:

659M    2014-02-25 17:56    /home/sk/unixmen/Ubuntu 13.10
664M    2014-02-25 17:56    /home/sk/unixmen/

I hope you get the enough details and usage of du command. For more advanced details, please refer the man pages.

$ man du


FocusWriter: A Multi-platform Simple And Distraction-free Writer

Mostly, I have a hardcore habit to document something interesting on the web, whether it may be a how-to document or tips & tricks related to Linux and/or any technology, and I will share them later to all the readers here in Unixmen. I have been looking for a tool which is going to ease and enhance the documenting work for a couple of days. After a bit searching on the web, I have found a simple and cool writer application called “FocusWriter”.

FocusWriter is a simple, distraction-free writing environment. It utilizes a hide-away interface that you access by moving your mouse to the edges of the screen, allowing the program to have a familiar look and feel to it while still getting out of the way, so that you can immerse yourself in your work. It’s available for Linux, Windows, and Mac OS X, and has been translated into many different languages.


  • TXT, basic RTF, and basic ODT file support
  • Timers and alarms
  • Daily goals
  • Fully customizable themes
  • Typewriter sound effects (optional)
  • Auto-save (optional)
  • Live statistics (optional)
  • Spell-checking (optional)
  • Multi-document support
  • Sessions
  • Portable mode (optional)
  • Translated into over 20 languages


FocusWriter is available on all popular Linux distribution’s default repositories. So, you don’t have to add any extra repositories.

To install FocusWriter on Ubuntu/Debian based systems, enter the following command:

sudo apt-get install focuswriter

On Fedora based systems,

sudo yum install focuswriter


zypper in focuswriter

On Mageia:

urpmi focuswriter

Launch FocusWriter

After installing FocusWriter, open it up either from Dash or Menu. This is how FocusWriter interface looked.

(Untitled 1)- — FocusWriter_001

Then, start writing without any distraction. After completing your document, hover the mouse pointer on the top the FocusWriter window, and you will see the Menu and Tool bars. From there, you can save or close or align the documents.


Source: FocusWriter website




  • 默认分类 (24)
  • 运维 (53)
  • docker (1)
  • 动漫 (19)
  • 科普知识 (15)
  • 苍白边缘 (17)
  • 资源 (12)
  • Linux (58)
  • Arch Linux (19)
  • 计算机 (18)
  • 编程 (3)
  • Java (4)
  • python (0)
  • php (0)
  • 前端 (1)
  • 公告 (1)
  • 归档