Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 LINUX/UNIX


  /dev/null and /dev/tty in Linux

In Linux, there are two special files /dev/null and /dev/tty. /dev/null will drop all the data written to it, i.e, when program writes data to this file, it means the program has completed the data write operation. But in  fact it does nothing, if you just want the status of a command but not the output of a command, this feature will be very useful. See below shell codes:    /> vi test_dev_null.sh        #!/bin/bash    if grep hello TestFile > /dev/null    then        echo "Foun...

16,009 0       LINUX /DEV/NULL /DEV/TTY


  Guide for installing Ubuntu in VirtualBox on Windows

Have you ever tried to have two OSs installed on your PC? Do you want to try out the new Ubuntu system? If you do want to use Ubuntu when at the same time you are using Windows, you may want to install your Ubuntu in an VirtualBox. In this post, we will show you how to install Ubuntu in VirtualBox on Windows.Pre-requisitesVirtualBox -- You can download it from Oracle.Ubuntu -- You can download it from here. Please note it should be an ISO fileThe Ubuntu used in this post is Ubuntu 12.04 LTS.InstallationStep 1. Install the VirtualBox, it is like any other application installation on WindowsStep...

15,905 0       WINDOWS VIRTUALBOX UBUNTU


  Use rsync to delete mass files quickly in Linux

Yesterday I encountered an issue to delete many log files in my Linux workstation, there were around 100,000 files to be deleted. These are log files and they grow very fast, and we need to delete them frequently. Usually we would use rm -rf * to delete these files, but we may need to wait for a relative long time if there are too many files. So we must adopt some unusual way. Fortunately, we can use rsync to delete mass files in one shot.1. Install rsyncyum install rsync2. Create a new empty foldermkdir /tmp/test3. Use rsync to delete target folderrsync --delete-before -a -H -v --progress --s...

14,209 0       DEMO RSYNC DELETE FILE


  Using msmtp to replace sendmail

sendmail is a mail client in Linux with many vulnerabilities and tedius configuration steps, many system administrators have disabled using it. Then how do we know what happens if a crontab script executes with error?Actually there are some replacements for sendmail, one is ssmtp, but this application is no longer maintained, we even cannot find its source code on Google. Fortunately, we can use msmtp to replace sendmail. The address : http://msmtp.sourceforge.net/1. InstallationAfter downloading and decompressedm we run./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etcmakemake in...

13,547 0       SENDMAIL MSMTP REPLACEMENT


  SSH Security and You - /bin/false is *not* security

Backstory While at RIT around 2004 or 2005, I discovered that a few important machines at the datacenter allowed all students, faculty, and staff to authenticate against them via ssh. Everyone's shells appear to be set to /bin/false (or some derivative) on said machines, so the only thing you'll see after you authenticate is the login banner and your connection will close. I thought to myself, "Fine, no shell for me. I wonder if port forwarding works?" Seems reasonable, right? Whatever sysadmin was tasked with securing these machines forgot some...

12,957 0       SECURITY LINUX SSH /BIN/FALSE


  Understand diff in Unix

diff is an important tool program in Unix. It is used to compare differences of two files, it is the foundation for code version control. If you type :$ diff <file_before_change> <file_after_change>diff will tell you what's the difference between these two files. The result may not be so easy to understand, so now I will show you how to understand diff.1. 3 formats of diffdiff has 3 formats due to historic reasons.normal diffcontext diffunified diff2. Demo filesFor easy demonstration, we create 2 demo files.The first one is f1, it has 7 lines of a in it.aaaaaaaThe second file is f2...

12,261 0       UNIX DIFF VERSION CONTROL GIT


  Unix directory hierarchy history

As a beginner user of Unix or Linux, people would frequently get confused about the use of different directories of the system. For example, there is a /bin directory under root(/), it is used to store binary files. However, there are /usr/bin and /usr/local/bin under /usr which are used for storing binary files as well. Some systems even have /opt/bin. What are the differences among them?Though there are articles explaining different directories in *nix such as Filesystem Hierarchy Standard, it's not clear why these directories are present and their history. Rob Landley filled part ...

12,050 1       LINUX HISTORY UNIX FILESSYTEM DIRECTORY HIERARCHY


  Create host only network on VirtualBox

Previously we showed how to install Ubuntu in VirtualBox. What if we want to communicate with the host OS from within the Guest OS on VirtualBox? There are a few ways to do this. For example, bridged network, Host only networks. Today we will show you how to enable network communication between host OS and guest OS using host only networks.A host only network will not need to access the physical network interface of the host OS. It will create a network between different virtual machines and the host machine. This is very useful if you want to set up a network of machines which just need to co...

10,719 1       VIRTUALBOX NETWORK VIRTUAL MACHINE HOST-ONLY