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

SEARCH KEYWORD -- delete file



  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 rsync yum install rsync 2. Create a new empty...

   rsync,delete file, demo     2012-11-13 10:44:50

  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

  malloc/free and new/delete in C++

malloc and free are C++/C language standard library functions, while new/delete are operator of C++. They can be used to allocate dynamic memory and free memory in C++ programs malloc/free can not meet the requirements of dynamic objects creation. Object needs to call the constructor to initialize the object when creating, the object needs to call the destructor before it is destroyed  Since malloc() and free() are library functions rather than operators, the compiler has no control permiss...

   C++,memory,malloc,free,new,delete     2012-06-20 06:52:09

  Frequently used Git commands

Git configuration git config --global user.name "robbin" git config --global user.email "fankai@gmail.com" git config --global color.ui true git config --global alias.co checkout git config --global alias.ci commit git config --global alias.st status git config --global alias.br branch git config --global core.editor "mate -w" # Configure Editor to use textmate git config -l #List all configurations User's git configuration file : ~/.gitconfig Frequently used Git commands Check、add...

   Git,Command     2013-03-11 19:41:06

  How does MySQL handle DROP TABLE

A few days ago, when executing DROP TABLE in MySQL, all processes including DDL and DML were hung until DROP TABLE was completed. I am confused about this phenomenon. I have reviewed the source codes of MySQL to check how MySQL internally handle DROP TABLE. When user trigger DROP TABLE command: ########################MySQL SERVER drop table######################## /* Sql_table.cc  delete (drop) tables. */bool mysql_rm_table( )   /*   Execute the drop of a normal or temporary...

   MySQL,DROP TABLE     2012-09-24 11:34:05

  Ways to undo wrong Git operations

While using Git to version code, programmers would inevitably perform some invalid operations which are not expected. Sometimes it's difficult to deal with this kind of awkward situations. If the programmer chooses to undo the operation, the programmer needs to bear the risk of deleting something which is not supposed to be deleted if the undo is done improperly. If the programmer leaves it as is, the file needs to be updated again manually with a new commit. In this post, we will try to pr...

   GIT,GIT COMMIT,GIT RESET     2018-07-07 03:28:21

  Make a directory using C++ for windows

If you want to create a folder at windows using c++/cpp language, there is an easy way for make a folder. You can do it just including the <windows.h> header file. To make a folder at C:\ drive named "deadman"#include<windows.h>int main(){   CreateDirectory ("C:\\deadman", NULL);   return 0;}If you want to delete a fodler from the C:\ directory.#include<windows.h>int main(){   RemoveDirectory("C:\\deadman");   retur...

   C++,Directory,Windows,CreateDirectory,Example     2012-02-25 04:26:16

  Mac shortcut key cheatsheet

More and more people are using Mac computers or switch from Windows or other OS to MacOS, there are lots of shortcut keys which can help improve the work efficiency or ease operations. This post will try to list some commonly used shortcut keys in Mac. But before that, let's first know some common keys on a Mac computer keyboard. There are four major function keys: Command, Control, Option and Shift. Most of the shortcut keys will combine the functional key and other key. Basic Command key is t...

   SHORTCUT,SCREENSHOT,COMMAND,SHORTCUT KEY,MACOS     2019-02-05 07:13:06

  My frequently used Linux commands

In our day to day work. We may have many chances working on Linux/Unix systems. There are many things we may need to do, checking logs, navigating in directories, creating file or installing software. We may use many commands to complete the work, such as ls, mkdir, cd etc. Below are my frequently used Linux commands or programs recently: pwd : print working directory, sometimes I need to check which working directory I am in in order to know where to go next. ls : List current directory files,...

   Linux,Command,Program     2012-08-16 15:09:42

  Algorithm : Delete middle node from singly linked list

Questions about singly linked list are frequently asked during technical interviews. Today we will share with you one algorithm question about singly linked list. Here is the problem description. Assuming the only information you are giving is there is a pointer to a middle node of a singly linked list, no other information about the linked list is given. Please delete this node and don't affect the structure of the linked list. Initially you may think this question is easy if you know the hea...

   ALGORITHM,C,LINKED LIST     2015-10-30 05:21:25