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

SEARCH KEYWORD -- /dev/tty



  /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...

   Linux,/dev/null,/dev/tty     2013-03-04 02:23:23

  Shortest command on Linux

Usually when we log in to a Linux system,. we may type some frequently used Linux commands such as pwd,ls, ps etc. All these commands are really simple but powerful with different options. But do you know what is the shortest command on Linux? The answer is w. According to Linux manual, w will show who is logged on and what they are doing on the system. w displays information about the users currently on the machine, and their processes. The header shows, in this order, the current time, how l...

   Linux,w,shortest command     2014-04-30 11:07:38

  One reason why mcrypt responds slowly

This morning one colleague came over and talked about one script which used mcrypt responded very slowly, the server configurations are fine. But the reason for the slowness is unknown. Here is one script which reproduces the issue: <?php $dmcryptText = "dummy"; $key = "foobar"; $size = mcrypt_get_iv_size(MCRYPT_BLOWFISH,MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($size); //Take care $m = mcrypt_ecb(MCRYPT_BLOWFISH, $key, $dmcryptText, MCRYPT_DECRYPT, $iv); var_dump($m); When 20 requests of&...

   SOLUTION,SLOW,MCRYPT,RESPONSE,PHP     2012-09-27 12:03:16

  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/time.nist.gov/13 56188 12-09-18 15:34:26 50 0 0 733.5 UTC(NIST) * bash-4.2$ exec 3<>/dev/tcp/www.w3.org/80 bash-4.2$ echo -e "GET / HTTP/1.0\n\n" >&3 b...

   Bash,Network interface,/dev/tcp     2013-07-20 00:57:52

  How to use Chome dev tool to find event handler bound to an element

As a front end developer, there is frequent need to debug JS code and sometimes need to find out what event handler has been bound to a HTML element. In this post, we will show how to find out the click event handler bound to a HTML element, this same applies to other events as well. Nowadays, a web application is usually very complicated and there are lots of JS codes which makes it difficult to find out what click event handler has been bound to a HTML element, especially when the JS source co...

   JAVASCRIPT,CHROME,CHROME DEV TOOL,EVENT LISTENER     2019-08-17 22:14:36

  Check whether a remote server port is open on Linux

As a system administrator or network engineer or application developer, there is a need to check whether a port on remote server is open so that you can tell whether the service under check is running or not. In this post, we would cover a few methods to check whether a remote server port is open or not on Linux. telnet telnet is the most frequently used command on both Windows and Linux to check port. The simple usage for this command is  telnet [host] [port] When the port is open, the o...

   LINUX,TELNET,PORT,NC,NMAP     2017-12-23 11:45:20

  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...

   tmpfs,Linux,file system     2013-06-14 12:10:56

  Recover deleted file in Linux EXT3 file system

Environment : CentOS 5.3 x86_64, /dev/sdb1 is the data segment /data0. EXT3 file system. Problem : /data0/tcsql/cankao/phpcws-1.5.0/httpcws.cpp is deleted mistakenly and httpcws.cpp is not backed up. It will take much time to rewrite this program again. So we must recover it back. debugfs is feasible in EXT2 file system, but in EXT3 file system, it's not very useful. There is one open source software called ext3grep which can help us recover deleted file in EXT3 file system. The recovery steps a...

   Linux,EXT3,File recovery     2013-08-16 07:06:45

  A possible way to recover deleted files on Linux

Last week I was generating a MD5 sum for an virtual machine image on one OpenNebula server: # ls -l test.img -rw-r--r-- 1 root root 10486808576 Oct 12 02:21 test.img # md5sum test.img At the same time I was clearing the files on the server on another terminal and deleted the above image file mistakenly with : # rm test.img Since this image file is 10GB, it took some time to remove this file from the server, so I used the Ctrl+Z command to suspend the remove command. [1]+ Stopped ...

   Linux,File,Recovery     2013-11-26 07:03:37

  Why Microsoft chooses Alt+F4 to close a window

For a long time, there is a doubt among lots of Windows users especially those English speaking users, that is why Microsoft chooses Alt+F4 to close a window instead of Alt+Q. Alt+Q is more comfortable to press for many keyboards, also Q represents Quit and it is easier for people to understand. Recently Microsoft answered this doubt. Raymond Chen, longtime Microsoft developer and semi-official Windows historian, said the reason is that not everyone speaks English. It d...

   WINDOWS,MICROSOFT,HISTORY,ALT+F4     2016-02-23 09:56:41