- Home
- Interview Questions
- Unix
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]
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.
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.
Use "-t" switch with the inbuilt [unzip] command
$> unzip -t file.zip
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.