Collections of Cool Linux Commands

Collections of Cool Linux Commands

Command History
Runs previous command but replacing
Really useful for when you have a typo in a previous command. Also, arguments default to empty so if you accidentally run: echo "no typozs", you can correct it with ^z
^foo^bar replaces first instance of foo. If you want to replace multiple instances of a string, then you should use: !!:gs/foo/bar
Check command history, but avoid running it
!whatever will search your command history and execute the first command that matches 'whatever'. If you don't feel safe doing this put :p on the end to print without executing.
Run the last command as root
sudo !!
Make sudo forget password instantly
sudo -K
Execute a command at a given time
echo "ls -lah >/foo/bar/ls.txt" |at 07:00
Execute a command without saving it in the history
Prepending one or more spaces to your command won't be saved in history, useful for pr0n or passwords on the commandline.

Salvage a broken terminal
stty sane
If you bork your terminal by sending binary data to STDOUT or similar, you can get your terminal back using this command
Running scripts after a reboot for non-root users.
$ @reboot
Sometimes we may want to run a script when a system reboots. We can simply do this by just scheduling the script using vixie cron with the @reboot option

File && Directory
Prevent accidents and test your command with echo
echo rm *
Empty a file
> file.txt
List the size (in human readable form) of all sub folders from the current location
du -h --max-depth=1
Like top, but for files
watch -d -n 2 'df; ls -FlAt;'
Remove all but one specific file
rm -f !(survivior.txt)
Quickly backup or copy a file with bash
cp filename{,.bak}

SSH - Remote Server
Copy ssh keys to user@host to enable password-less ssh logins.
ssh-copy-id user@host
Compare a remote file with a local file
ssh user@host cat /path/to/remotefile | diff /path/to/localfile -
vimdiff scp://[@]/
vimdiff scp://[user@]host1/ scp://[user@]host2/
Start a tunnel from some machine's port 80 to your local post 2001
ssh -N -L2001:localhost:80 somemachine
Run command on a group of nodes in parallel
echo `date` | pee "ssh host1" "ssh host2" "ssh host3"

Lists all listening ports together with the PID of the associated process
netstat -tlnp
List all open ports and their owning executables
lsof -i -P | grep -i "listen"

Download an entire website
wget --random-wait -r -p -e robots=off -U mozilla
-p parameter tells wget to include all files, including images.
-e robots=off you don't want wget to obey by the robots.txt file
-U mozilla as your browsers identity.
--random-wait to let wget chose a random number of seconds to wait, avoid get into black list.
Other Useful wget Parameters:
--limit-rate=20k limits the rate at which it downloads files.
-b continues wget after logging out.
-o $HOME/wget_log.txt logs the output
The default recursion depth is now 5, which is often enough to download entire sites. However, if you want to be sure, add a '-l 0' to remove the recursion depth limit.

Serve current directory tree at http://$HOSTNAME:8000/
python -m SimpleHTTPServer
To use a different port:
python -m SimpleHTTPServer 8080
twistd -n web --path .
python -m smtpd -n -c DebuggingServer localhost:1025
Capture video of a Linux desktop
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 /tmp/outputFile.mpg
Create a single PDF from multiple images with ImageMagick
$ convert *.jpg output.pdf
mtr, better than traceroute and ping combined
Find out my Linux distribution name and version
cat /etc/*-release
cat /proc/version
lsb_release -a

Display currently mounted filesystems in nice layout
mount | column -t
A very simple and useful stopwatch
time read (ctrl-d to stop)
Quick access to the ascii table.
man ascii
Clear the terminal screen
ctrl+l, clear
Pretend to be busy in office to enjoy a cup of coffee
$ for i in `seq 0 100`;do timeout 6 dialog --gauge "Install..." 6 40 "$i";done
cat /dev/urandom | hexdump -C | grep "ca fe"
Just make some data scrolling off the terminal.

4 Websites to Learn Cool Linux Command Line Tricks
good coders code, great reuse


From Apprentice to Master

How to Become a Great Programmer

From Apprentice to Master

Emptying Your Cup
Ask the most experienced and available programmer you know for ongoing help.
Never become completely dependent on your more experienced friend to solve all your problems.
Have an actual problem to solve

Learn to think differently by/when learning a new language
Set your previous knowledge aside as you approach new situations.
Make sure your new implementation follows the idioms of the new language.
Unleash Your Enthusiasm (to your team)
Inject some excitement, your ideas, intelligence, and passions into your team.
Question everything
Determine which of these skills would be immediately useful to the team, and strive to acquire the knowledge.
Expose Your Ignorance and Confront Your Ignorance
Brave to ask for help.

Prepare and grasp the opportunity to assume a high-profile role or solve a difficult problem.
Craft over Art
Place the interests of your customers over your desire to display skill
Nurture/Grow Your Passion and Keep Sustainable Motivations
Keep the sense of wonder/curiosity
Be ambitious about your career.
Draw Your Own Development/Career Map

Accurate Self-Assessment
Evaluate yourself frequently and know your weaknesses, and combat them.
Find Mentors to get advices
Kindred Spirits
Immerse into the community
Sweep the Floor for the team
Volunteer for unglamorous, yet necessary, tasks.

Perpetual Learning
Expand Your Bandwidth
Action Items:
l          Subscribe to software development blogs in Google Reader
l          Follow some software luminaries on Twitter
l          Subscribe to an online mailing list and answer people’s questions.
l          Join a newly formed local technology user group
l          Attend technical conference
l          There are hundreds of online academic courses, podcasts, and videos (Google Tech Talks) on iTunes and YouTube.

Keep Practice and Make Breakable Toys
Use the Source, Read and Learn from the code
Use your skills you learn at work
Reflect As You Work
Observation, reflection, and learn from your own activities, your colleagues.
Take notes everywhere, anytime
Record What You Learn and Share What You Learn

Create Feedback Loops
Solicit feedback early, often, and effectively, be conscious of your incompetence.
Pay careful attention to any feedback; avoid defending your behaviors, your skills.
Learn How/Why You Fail

Construct Your Curriculum

Build and Maintain Your Reading List
Read Constantly
Study the Classics

Dig Deeper
Get your information from primary sources
Understand the forces that led to a design rather than just the details of a design.
Understand Why - the problems trying to solve
Understand How it is solved, implemented.

Letting go of familiar and valuable tools
Keep an open mind and learn something new
Understand your tools, knowledge will become obsolete, they need be upgraded.
Discover problems of the tools you use, find whether there are better alternatives.
If not, it's your time to show your talent.

Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman

My Reading List for 2010

My Reading List for 2010

As suggested in the book - Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman, it's time to make my reading book list for 2010 to track the books I plan to read, and remember the books I have read.

This is just a book list I plan to read; maybe or maybe not I will finish reading them one day.
I will constantly update this list, and one year later I would like to see what I have read, what I have improved in this one year.

And if you occasionally visit this page, and have suggestions about what I should read next, what I should improve to be a successful software craftsman, please leave you comments.
I would be thankful for your kindly help and suggestions : )

RESTful Java with Jax-RS (Animal Guide)        [Done]
Java Soa Cookbook                                                 [Reading]
Cloud Computing

Coding Skills
Clean Code: A Handbook of Agile Software Craftsmanship        [Reading]

Classic Software Books
Patterns of Enterprise Application Architecture
Design Patterns
Have read several books about this topic before, but I think I have never got a comprehensive and deep understanding about it.

Design Skills
Practical API Design: Confessions of a Java Framework Architect     [Reading]
Working Effectively with Legacy Code

Architect Skills
97 Things Every Software Architect Should Know: Collective

Become a better developer
Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman    [Done]
The Passionate Programmer: Creating a Remarkable Career in Software Development (Pragmatic Life)        [Read Next]
The Pragmatic Programmer: From Journeyman to Master
97 Things Every Programmer Should Know: Collective Wisdom from the E

How to Think About Algorithms          [Reading]
The Algorithm Design Manual             [Reading]

Better thinking
Enhance the ability to think bigger, differently, and innovatively.
Pragmatic Thinking and Learning: Refactor Your Wetware (Pragmatic Programmers)
[Read Next]

Better Brain
Keep brain sharp and improve overall memory

Learn skills of learning

Other Skills
English Writing Skills

Green      – [Finished]
Yellow    – [Reading]
Pink        - [Read Next]

New Features in Java EE 6.0

New Features in Java EE 6.0

Profiles: Different Strokes for Different Folks
One of the major criticisms of Java EE has been that it is simply too large. Indeed, a majority of small to medium range Java web applications do not utilize the full Java EE stack.

The main goal of the Profiles is to address this issue, to reduce the size of the platform to suit the developer’s needs more efficiently.
Profiles are essentially sub-sets of Java EE APIs geared towards a particular class of applications in mind.

Java EE 6 includes the first of these profiles called Web Profile which is a subset of the Java EE platform designed for web application development. The Web Profile is the light-weight version of Java EE and includes only those technologies needed in most web applications, and does not include the enterprise technologies that these web applications typically don't need..
Pruning the Dead Wood
Since Java EE was first released in 1999, each release added new specifications. None of the features has been completely removed from the specification.

This became a problem in terms of size, implementation, the installation time, and adoption. Some features were not well supported or not widely deployed because they were technologically outdated or other alternatives were made available in the meantime.

The platform is weighted down with some dead wood in the shape of APIs that are outdated, not well supported or not widely deployed.

Java EE 6 has adopted the pruning process (also known as marked for deletion) already adopted by the Java SE group. Pruning these APIs would make the platform more lightweight and make room for healthier growth.

The suggested proposals are JAX-RPC, EJB 2.x Entity Beans CMP, JAXR (one of the few Java APIs for interfacing with UDDI registries)...
Provide significant enhancements in EJB, Servlets, JSF, and JSP technologies.
Servlet 3.0
Modular web.xml, web fragments to provide better support for frameworks
Allow programmatic addition of Servlets and Filters at start up time of an application
Asynchronous support
Ease of Development, Annotations vs. Deployment Descriptor
Other Miscellaneous Changes
HttpOnly Cookies
API changes
Contexts and Dependency Injection for Java EE
This(JCDI) allows developers to bind Java EE components to lifecycle contexts, to inject these components, and to enable them to support loosely coupled communication. Java EE components can also fire and get notified of events with JCDI. The benefit is that different kinds of objects, such as EJB 3 session beans, POJOs, and Java EE resources, can all be injected. JCDI provides a good facility for integrating the web tier and Java EE enterprise services.
JAX-RS 1.1 to create REST-based web services
Web Beans
Enterprise JavaBeans 3.1
EJB Lite
Removal of local business interface
Business interfaces also are not mandatory.
Packaging EJB components directly in a WAR file
Embeddable API for executing EJB in Java SE environment
This is to facilitate better support for testing, batch processing, and using EJB from the desktop applications.
Introduction of Singleton beans
Asynchronous Session Bean
JSF 2.0
JPA 2.0

Bean Validation 1.0 - annotation-based validation API

More Portable
Standard global JNDI names
Java EE 6 specifies a syntax for JNDI names that is the same across application servers
EJB 3.1 specifies an embedded container that is a standard API for executing EJBs within a Java SE environment.

The Java EE 6 Tutorial
Java EE 6 Overview
New Features in Java EE 6
New Features in Java EE 6.0
New Features in Servlets 3.0

Great Words to Replace Common Words

Vocabulary Workshop:

Great Words to Replace Common Words

begin, start, commence
rely on, depend on
follow, keep up with, up to date
take advantage of, utilize,
improve, boost, promote, advance, enhance
promote the trade between A and C.
Our understanding of human genetics has considerably advanced.
The publicity has enhanced his reputation.
assess, judge
desire, want
bear in mind that, remember
tackle, handle with, solve
prepare, prep(ping)
change, transform
The increasing population has transformed the landscape and structure of local industry structure.

emphasize, highlight, stress, accentuate
The report highlight the decline in the numbers of native plants and insects.
He stresses the need for parents to listen to their children.
The crisis accentuates the gap between rich and poor.

develop, cultivate, nurture
cultivate the ability of
cultivate a more relaxed and positive way towards life.
The sea nutures ample marine animals.

break, impair, undermine, jeopardize, fevastate
Undermine one’s ability/confidence/authority/position/credibility
Jeopardize the process of peace.
The earthquake devastated the whole city.

Keep, Preserve, Conserve, protect
deal With, tackle, resolve:
resolve dispute/conflict/problem/issue/crisis

external, third-party
right, correct
main, primary
effectively, efficiently
consistent with, compatible with
missing, absent
feasible, possible, probable
viable, valuable
beneficial, rewarding, helpful
exceedingly, extremely, intensely, very
hardly necessary, hardly inevitable,  unnecessary, avoidable
Everywhere, Widespread, Prevalent, Overflow, Rampant
Drug abuse is especially prevalent among teenagers.
The garden is overflew with colors of flowers.
H1n1 Virus is rampant in the world.

Good, Impressive, glorious, amazing, brilliant, incredible, attractive…

Beneficial(antonym:detrimental), Advantageous
The drug is beneficial to the immune system.
Advantageous industry 优势产业

Harmful, Unfavorable, horrible, disgusting
Inhumane: 没人性的
lousy (I’m fed up with the lousy job.)
severe (severe problem, illness, injuries.)
abysmal(低谷: their performance is abysmal.)
Detrimental: smoking is detrimental to your health.

Rich, Wealthy, Affluent, ample

Poor, Impoverished
The great depression had impoverished many third world countries.
an impoverished student.

Serious, Severe

Obvious, Manifest, Apparent, Evident, Patent
a manifest error judge
manifestly unfair system.
patent impossibilities. 显然不可能的事。

cheap, Economical:经济的,不浪费,而不是单纯指某物便宜, Inexpensive=cheap, Reasonable价格合理的, Affordable:能够支付的
economically affordable housing经济适用房
Reasonable price

estate, asset
applicant, candidate, interviewee
responsibility, duty
shopper, client, consumer, purchaser, customer
interaction, communication
Forefather, Ancestor, Predecessor

Difference, Gap, Distinction, schism
generation gap
sharp/clear distinction between allergy and food intolerance
heal the schism between clinical medicine and public health.

Criminal Act

Environment, Circumstance, Atmosphere, Ambience
under the circumstances
Surrounding:表示周围居住的环境,想当具体。Nearby可与之互换。The surrounding area.

Pollution, Contamination
contaminated water

Human, Individual/men/ones, Humankind
The human race

Danger, Hazard
Polluted water is a hazard to wild life and nature;safety/nature hazard.

In modern society, In contemporary society, In present-day society, In this day and age
otherwise, or

frown on sth, be against, disagree with sth
next to/virtually impossible, , nearly/almost impossible
to name only a few, as an example,  for example, for instance
sth appeals to sb, sth exerts a tremendous fascination on sb, sb take interest in/sb. be interested in
little if anything, little or nothing, hardly
capture one's attention, attract one's attention.
give rise to, lead to, result in, trigger, cause
There are several reasons behind sth, reasons for sth
drive sb nuts, drive sb crazy
as stated earlier, as mentioned earlier
This is a time, this is an opportunity

3000 Most Common Words in American English


Java (161) Lucene-Solr (112) Interview (64) All (58) J2SE (53) Algorithm (45) Soft Skills (39) Eclipse (33) Code Example (31) JavaScript (23) Linux (22) Spring (22) Tools (22) Windows (22) Web Development (20) Nutch2 (18) Bugs (17) Debug (16) Defects (14) Text Mining (14) Troubleshooting (14) J2EE (13) Network (13) Tips (12) PowerShell (11) Chrome (10) Problem Solving (10) Design (9) How to (9) Learning code (9) Performance (9) Security (9) UIMA (9) html (9) Http Client (8) Maven (8) bat (8) blogger (8) Big Data (7) Database (7) Google (7) Guava (7) JSON (7) Shell (7) System Design (7) ANT (6) Coding Skills (6) Lesson Learned (6) Programmer Skills (6) Scala (6) css (6) Algorithm Series (5) Cache (5) Continuous Integration (5) IDE (5) adsense (5) xml (5) AIX (4) Become a Better You (4) Code Quality (4) Concurrency (4) GAE (4) Git (4) Good Programming Practices (4) Jackson (4) Life (4) Memory Usage (4) Miscs (4) OpenNLP (4) Project Managment (4) Review (4) Spark (4) Testing (4) ads (4) regular-expression (4) Android (3) Apache Spark (3) Distributed (3) Dynamic Languages (3) Eclipse RCP (3) English (3) Happy Hacking (3) IBM (3) J2SE Knowledge Series (3) JAX-RS (3) Jetty (3) Mac (3) Python (3) Restful Web Service (3) Script (3) regex (3) seo (3) .Net (2) Android Studio (2) Apache (2) Apache Procrun (2) Architecture (2) Batch (2) Bit Operation (2) Build (2) Building Scalable Web Sites (2) C# (2) C/C++ (2) CSV (2) Career (2) Cassandra (2) Fiddler (2) Google Drive (2) Gson (2) How to Interview (2) Html Parser (2) Http (2) Image Tools (2) JQuery (2) Jersey (2) LDAP (2) Logging (2) Software Issues (2) Storage (2) Text Search (2) xml parser (2) AOP (1) Application Design (1) AspectJ (1) Chrome DevTools (1) Cloud (1) Codility (1) Data Mining (1) Data Structure (1) ExceptionUtils (1) Exif (1) Feature Request (1) FindBugs (1) Firefox (1) Greasemonkey (1) HTML5 (1) Httpd (1) I18N (1) IBM Java Thread Dump Analyzer (1) Invest (1) JDK Source Code (1) JDK8 (1) JMX (1) Lazy Developer (1) Machine Learning (1) Mobile (1) My Plan for 2010 (1) Netbeans (1) Notes (1) Operating System (1) Perl (1) Problems (1) Product Architecture (1) Programming Life (1) Quality (1) Redhat (1) Redis (1) RxJava (1) Solutions logs (1) Team Management (1) Thread Dump Analyzer (1) Visualization (1) boilerpipe (1) htm (1) ongoing (1) procrun (1) rss (1)

Popular Posts