0% found this document useful (0 votes)
25 views9 pages

CSE 314: Operating Systems Sessional: Shell Tips & Tricks

shell scripts tips and tricks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views9 pages

CSE 314: Operating Systems Sessional: Shell Tips & Tricks

shell scripts tips and tricks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

CSE 314: Operating Systems

Sessional
Shell tips & tricks
Clear the screen

You can clear the screen with CTRL + L


Copy & Paste on shell

● CTRL+C & CTRL+V do not work in shell


● Double click (or select) something with a mouse to copy and click the
middle button to paste
Switch between directories

cd - => Changes the working directory to the previous working directory.


File extension does not matter

● In unix like operating systems, the OS does not determine file type from
file extension
● We can check a file type with the ‘ file’ command
Be careful with rm

Whenever you use wildcards with rm (besides carefully checking your


typing!), test the wildcard first with ls. This will let you see the files that will
be deleted. Then press the up arrow key to recall the command and replace
the ls with rm.
Good old history

You can view your command history with history command

To put a previous command in action you can get the number from history
and call it with a preceding !
Create a new text file

truncate a file (or create a new, empty file) we can use a trick like this:

> ls-output.txt
Brace expansion

mkdir {2009..2011}-0{1..9} {2009..2011}-{10..12}

You might also like