`xargs` passes the argument once to the utility command specified. For example, xargs cat will cat every line passed to xargs. But how to use the xargs argument twice in the command on Linux? For example, to rename file to file.bak where file is from the stdin. One solution is to write a small script like
Read more
Tag: xargs
How to manually kill HDFS DataNodes?
Posted onstop-dfs.sh report that there are no datanodes running on some nodes like hdfs-node-000208: no datanode to stop However, there are DataNode process running there. How to clean these processes on many (100s) of nodes? You may use this piece of bash script: for i in `cat hadoop/etc/hadoop/slaves`; do echo $i; ssh $i ‘jps | grep
Read more
How to force a USB 3.0 port to work in USB 2.0 mode in Linux?
Posted onWe know that we can disable USB 3.0 in the BIOS. But is there a way to force a USB 3.0 port to work in USB 2.0 mode inside of a running Linux? On Linux on some platforms booted in BIOS modes, you can use the following command to force USB 2.0 modes for your
Read more
How to get files without certain strings in their files names (reverse of *string*) on Linux?
Posted onTo get files with certain string in their file names, it is quite straightforward: ls *string* However, how to do the reverse one: how to get files without certain strings in their files names on Linux? You can get a list of file names by a combination of find and xargs as follows: find .
Read more
how to remove specific directories recursively
Posted onHow to remove .svn directories under hlfs dir recursively as follows. weiwei@weiwei-HP-Compaq-dx6128-MT-PX478AV:~/workshop1/hlfs > find ./ -name “.svn” ./test/build/.svn ./test/.svn ./output/conf/.svn ./output/lib32/.svn ./patches/.svn ./src/include/.svn ./src/include/api/.svn ./src/snapshot/.svn ./src/snapshot/unittest/build/.svn ./src/snapshot/unittest/.svn ./src/utils/.svn ./src/clean/Mapreducer/build/.svn ./src/clean/Mapreducer/.svn ./src/clean/.svn ./src/clean/unittest/.svn ./src/icache/.svn ./src/icache/unittest/.svn ./src/backend/.svn ./src/storage/.svn ./src/cache/.svn ./src/cache/unittest/.svn ./src/clone/.svn ./src/tools/.svn ./src/tools/unittest/.svn ./src/logger/.svn weiwei@weiwei-HP-Compaq-dx6128-MT-PX478AV:~/workshop1/hlfs > find ./ -name “.svn” | xargs rm -rf
Generating TAGS file for Emacs recursively?
Posted onHow to generating TAGS file for Emacs recursively? etags seems not support recursively generating TAGS file. I use ctags instead. It can also generate TAGS file for Emacs with the -e option: ctags -e -R . You can also use etags with find: find ./ -print | xargs etags But I prefer the ctags way.
How to install Python environment in my own account on Dreamhost?
Posted onHow to install Python environment in my own account on Dreamhost so that my application can use the python that I installed by myself instead of the system-wide one? The post for Bluehost works very well for Dreamhost too: https://my.bluehost.com/cgi/help/python-install In short: mkdir ~/python cd ~/python wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz tar zxfv Python-2.7.2.tgz find ~/python -type d
Read more
svn: how to clean up my repository directory?
Posted onI have a local svn repository. I work in the repository, e.g. compiling latex documents and building software packages, and there are many useless temporary files there. How can I clean it up by automatically clean these temporary files like the git clean -f in git? svn seems has no built-in function for this. But
Read more