March11
We can use the below commands to display only the directory names
$ echo */
Scripts/ unix-commands-cheat-sheet_files/
$ printf “%s\n” */
Scripts/
unix-commands-cheat-sheet_files/
$ ls -d */
Scripts/ unix-commands-cheat-sheet_files/
$ ls -l | grep ^d
drwxr-xr-x 2 kamaraj kamaraj 4096 2011-03-11 21:25 Scripts
drwxr-xr-x 4 kamaraj kamaraj 4096 2011-02-09 01:11 unix-commands-cheat-sheet_file
$ find . -maxdepth 1 -type d
.
./unix-commands-cheat-sheet_files
./Scripts
March11
In linux we can easily get the last executed command using the below command.
echo “!!”
execute the last executed command by simply typing two !!
!!
you can easily redirect the output into one more script file.
echo “!!” > test.sh
March11
Create a simple shell script as follows.
echo “Hello World”
save the file as hello_world
And now you can see the file permission using the ls -l command.
$ ls -l hello_world
-rw-r–r– 1 kamaraj kamaraj 19 2011-03-11 20:40 hello_world
Now type sh hello_world in the terminal.
$ sh hello_world
hello world
Recent Comments