Linux Tip 26: How to disable the colored fonts

$$Q: How to disable all color output? like “ls”

if you are using PUTTY to remotely access the shell, then:
– on the left panel, click Colours under Window.
– uncheck Allow terminal to specify ANSI colors and Allow terminal to user xterm 256-color mode (they are checked by default)

if other connection, by default,

LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd                =40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=0                1;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.                tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz                =01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.d

$unset LS_COLORS, will remove all kinds of color for fonts and only left with blue color to display on directories.

$ ls –color=never <-it will disable the color output

$alias ls=”ls –color=never”, it take options as “auto, always”.



Programming: curl

curl – transfer a URL

curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.

curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more.

-C, allow resume the interrupted download

-d, –data <data>

(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded. Compare to -F, –form.

-d, –data is the same as –data-ascii. –data-raw is almost the same but does not have a special interpretation of the @ character. To post data purely binary, you should instead use the –data-binary option. To URL-encode the value of a form field you may use –data-urlencode.

If any of these options is used more than once on the same command line, the data pieces specified will be merged together with a separating &-symbol. Thus, using ‘-d name=daniel -d skill=lousy’ would generate a post chunk that looks like ‘name=daniel&skill=lousy’.

If you start the data with the letter @, the rest should be a file name to read the data from, or – if you want curl to read the data from stdin. Multiple files can also be specified. Posting data from a file named ‘foobar’ would thus be done with –data @foobar. When –data is told to read from a file like that, carriage returns and newlines will be stripped out. If you don’t want the @ character to have a special interpretation use –data-raw instead.

-k, –insecure

(SSL) This option explicitly allows curl to perform “insecure” SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered “insecure” fail unless -k, –insecure is used.

-L option, it will allow to follow URL redirection.

*o (lowercase o) the result will be saved in the filename provided in the command line

*O (uppercase O) the filename in the URL will be taken and it will be used as the filename to store the result

$curl -o mygettext.html

$ curl -O ($ curl -O URL1 -O URL2)

-x option. We need to specify the host and port of the proxy.

$ curl -x

-v, –verbose

Be more verbose/talkative during the operation. Useful for debugging and seeing what’s going on “under the hood”. A line starting with ‘>’ means “header data” sent by curl, ‘<‘ means “header data” received by curl that is hidden in normal cases, and a line starting with ‘*’ means additional info provided by curl.

Note that if you only want HTTP headers in the output, -i, –include might be the option you’re looking for.

If you think this option still doesn’t give you enough details, consider using –trace or –trace-ascii instead.

This option overrides previous uses of –trace-ascii or –trace.

Use -s, –silent to make curl quiet.

-H, –header <header>

(HTTP) Extra header to include in the request when sending HTTP to a server. You may specify any number of extra headers. Note that if you should add a custom header that has the same name as one of the internal ones curl would use, your externally set header will be used instead of the internal one. This allows you to make even trickier stuff than curl would normally do. You should not replace internally set headers without knowing perfectly well what you’re doing. Remove an internal header by giving a replacement without content on the right side of the colon, as in: -H “Host:”. If you send the custom header with no-value then its header must be terminated with a semicolon, such as -H “X-Custom-Header;” to send “X-Custom-Header:”.

curl will make sure that each header you add/replace is sent with the proper end-of-line marker, you should thus not add that as a part of the header content: do not add newlines or carriage returns, they will only mess things up for you.

See also the -A, –user-agent and -e, –referer options.

Starting in 7.37.0, you need –proxy-header to send custom headers intended for a proxy.

-X, –request <command>

(HTTP) Specifies a custom request method to use when communicating with the HTTP server. The specified request method will be used instead of the method otherwise used (which defaults to GET). Read the HTTP 1.1 specification for details and explanations. Common additional HTTP requests include PUT and DELETE, but related technologies like WebDAV offers PROPFIND, COPY, MOVE and more.

Normally you don’t need this option. All sorts of GET, HEAD, POST and PUT requests are rather invoked by using dedicated command line options.

#curl -XGET -kv -H “`get-oauth-creds –header`” “https://testserver/networkcategories/”

#curl -XGET -kv -H “`get-oauth-creds –header`” “https://testserver/networkcategories?page=5&size=200&metadata=true” |jpp

#curl -XGET -kv -H “`get-oauth-creds –header`” “https://testserver/networkcategories?fieldName=naturalId&page=1″

#curl -XPOST -kv -H  “`get-oauth-creds –header`” -H “Content-Type:application/json” -d@networkCategory.json “https://testserver/networkcategories/”

#curl -XPUT -kv -H”if-Match: 1234567890″ -H  “`get-oauth-creds –header`” -H “Content-Type:application/json” -d@networkCategory.json “https://testserver/networkcategories/”

#curl -XPATCH -kv -H”if-Match: 987654321″ -H  “`get-oauth-creds –header” `” -H “Content-Type:application/json” -d@networkCategory.json “https://testserver/networkcategories/”

One might want to POST their message to a message board, and then PUT additional content into their message at a later date. POST create the contents and PUT updates the contents.

#curl -XDELETE -kv -H  “`get-oauth-creds –header`”  “https://testserver/networkcategories/”

With fields:

curl --data "param1=value1&param2=value2"


curl --form "fileupload=@my-file.txt"

Multipart with fields and a filename:

curl --form "fileupload=@my-file.txt;filename=desired-filename.txt" --form param1=value1 --form param2=value2

Without data:

curl --data ''

curl -X POST

curl --request POST

For a RESTful HTTP POST containing XML:

curl -X POST -d @filename.txt --header "Content-Type:text/xml"

or for JSON, use this:

curl -X POST -d @filename.txt --header "Content-Type:application/json"

Programming: Maven


Maven, a Yiddish word meaning accumulator of knowledge, was originally started as an attempt to simplify the build processes in the Jakarta Turbine project. There were several projects each with their own Ant build files that were all slightly different and JARs were checked into CVS. We wanted a standard way to build the projects, a clear definition of what the project consisted of, an easy way to publish project information and a way to share JARs across several projects.

The result is a tool that can now be used for building and managing any Java-based project. We hope that we have created something that will make the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project.

Maven’s Objectives

Maven’s primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with:

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features


#sudo apt-get install maven -y

How to test TCP/UDP ports

1. Test TCP ports

$telnet localhost 1020

2. Test UDP port

echo -n “hello” | nc -4u 4444

3. netstat -an | more


Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0*               LISTEN
tcp        0      0   *               LISTEN
tcp        0      0   *               LISTEN
tcp        0      0*               LISTEN
tcp        0      0   *               LISTEN
tcp        0      0  *               LISTEN
tcp        0      0  *               LISTEN
tcp        0      0    *               LISTEN
tcp        0      0    *               LISTEN
tcp        0      0 *               LISTEN
tcp        0     64      ESTABLISHED
tcp        0      1   SYN_SENT
tcp6       0      0 :::443                  :::*                    LISTEN
tcp6       0      0 :::53628                :::*                    LISTEN
tcp6       0      0 :::445                  :::*                    LISTEN
tcp6       0      0 :::40352                :::*                    LISTEN
tcp6       0      0 :::139                  :::*                    LISTEN
tcp6       0      0 :::8080                 :::*                    LISTEN
tcp6       0      0 :::80                   :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 ::1:631                 :::*                    LISTEN
tcp6       1      0 ::1:52782               ::1:631                 CLOSE_WAIT
udp        0      0   *
udp        0      0  *
udp        0      0    *
udp        0      0   *
udp        0      0*


Programming: Jenkins


In a nutshell, Jenkins CI is the leading open-source continuous integration server. Built with Java, it provides over 1000 plugins to support building and testing virtually any project.


wget -q -O - | sudo apt-key add -
sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

What does this package do?

  • Jenkins will be launched as a daemon up on start. See /etc/init.d/jenkins for more details.
  • The ‘jenkins‘ user is created to run this service.
  • Log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.
  • /etc/default/jenkins will capture configuration parameters for the launch like e.g JENKINS_HOME
  • By default, Jenkins listen on port 8080. Access this port with your browser to start configuration.
If your /etc/init.d/jenkins file fails to start jenkins, edit the /etc/default/jenkins to replace the line




Here, 8081 was chosen but you can put another port available.