Home
16.
How to list down file/folder lists alphabetically?

Normally [ls -lt] command lists down file/folder list sorted by modified time. If you want to list then alphabetically, then you should simply specify: [ls -l]

17.
How to fail a shell script programmatically?

Just put an [exit] command in the shell script with return value other than 0. this is because the exit codes of successful Unix programs is zero. So, suppose if you write
exit -1
inside your program, then your program will throw an error and exit immediately.

18.
How to check the command line arguments in a UNIX command in Shell Script?

In a bash shell, you can access the command line arguments using $0, $1, $2, - variables, where $0 prints the command name, $1 prints the first input parameter of the command, $2 the second input parameter of the command and so on.

19.
How to test if a zip file is corrupted in Linux?

Use "-t" switch with the inbuilt [unzip] command
$> unzip -t file.zip

20.
How to show the non-printable characters in a file?

Open the file in VI editor. Go to VI command mode by pressing [Escape] and then [:]. Then type [set list]. This will show you all the non-printable characters, e.g. Ctrl-M characters (^M) etc., in the file.