Today's Question:  What are you most afraid of as a programmer?        GIVE A SHOUT



  bash network interface

Some of us may have seen /dev/tcp/<host>/<port> before, is this a special file system implemented in some BSD kernel? Because there is no /dev/tcp in Linux. Actually, this one is implemented in bash. We no need to rely on wget,nc to do network connection. It's very easy to use this interface: bash-4.2$ cat </dev/tcp/ 56188 12-09-18 15:34:26 50 0 0 733.5 UTC(NIST) * bash-4.2$ exec 3<>/dev/tcp/ bash-4.2$ echo -e "GET / HTTP/1.0\n\n" >&3 b...


  About tmpfs

tmpfs is another confusing name in Linux kernel, its implementation is in mm/shmem.c, shmem has no relation to tmpfs at first glance although we know tmpfs is based on memory. We can understand why we use this name by seeing where this is used. In a desktop Linux system, tmpfs is loaded usually: % grep tmpfs /proc/mountsdevtmpfs /dev devtmpfs rw,seclabel,nosuid,relatime,size=1958956k,nr_inodes=489739,mode=755 0 0tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev,relatime 0 0tmpfs /run tmpfs rw,seclab...

2,409 0 0          LINUX TMPFS FILE SYSTEM

  Funny Linux commands

1. sl You will see a train moving from the right to left on the screen. Install : $ sudo apt-get install sl Run : $ sl It has options like -aiFe: -a An accident seems to happen. You'll feel pity for people who cry for help.-l shows little one.-F It flies.-e Allow interrupt by Ctrl+C. We can also make fun of other people by setting an alias like below: $alias ls=sl When the user types ls, he will see the train instead of the file list. 2. fortune Output one statement, it can be a joke, or famous...


  Hello, Kernel!

When we learn module programming, the first small program must be hello, kernel!. For a novice, how do we avoid some mistakes and how to fix the bugs we have when writing the first module program? Is there any example we can refer to? Here is one example. 1. Write the hello.c 01 #include <linux/init.h> 02 #include <linux/module.h> 03 #include <linux/kernel.h> 04 //Compulsory 05 //Module lincese declaration 06 MODULE_LICENSE("GPL"); ...

2,513 0 0          LINUX MODULE KERNEL

  10 tools to make your shell script more powerful

Many people mistakenly think that shell scripts can only be run in command line. In fact shell can also call some GUI components such as menus,alert dialogs, progress bar etc. You can control the final output, cursor position and various output effects. Here we introduce some tools which can help you create powerful, interactive and user friendly Unix/Linux shell scripts. 1. notify-send This command can let you inform the process to send a desktop notification to users. This can be used to send ...

4,685 0 0          GUI SHELL ZENITY

  Build RPM package on Linux

1. Check the OS version and core version #uname -a #more /etc/redhat-release 2. Create relative directories /usr/src/redhat/SOURCES    //Store source codes, patches, icons etc /usr/src/redhat/SPECS        //Store specs about the process of building RPM packages /usr/src/redhat/BUILD     //File after uncompressed are stored here /usr/src/redhat/RPMS     //Store the binary files built with rpmbuild /usr/src/redhat/SRPMS&nbs...

3,645 0 0          LINUX BUILD RPM

  Linux Clock : CST,UTC and NTP setup

1. There is an option when you set up clock on installing Linux: system clock users UTC, so what does UTC mean? It's Universal Time Coordinated(UTC), there are two different times in GPS system: one is UTC , the other one is LT(Local Time). The difference between these two is just the timezone difference, UTC is the time in timezone 0. If the local time in Beijing is 8 o'clock in the morning, then UTC time is 0 o'clock, which is a 8 hour difference. 2. In Linux, when we use date to check the tim...

11,724 0 0          LINUX CLOCK UTC

  How to find which process a file is being written by in Linux?

Some people ask a file is being written by one process and they want to check this process, but they cannot find the process even with sof. This question is very common and there are many solutions, here we introduce a straightforward method. In Linux, each file will be stored on one device and of course there will be a relative inode, then we can use vfs.write to know who is writing the inode on one specified device continuously. Luckily there is inodewatch.stp in the installation package of s...

2,970 0 0          LINUX PROCESS FILE WRITE