improving your shell usage - 2010
DESCRIPTION
Introduction to using a shell talk given to new UWCS members in 2010. Overhaul of the 2009 version.TRANSCRIPT
![Page 1: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/1.jpg)
Improving your shell usage
by Chris Sinjakli (Sinjo)
![Page 2: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/2.jpg)
Why?
• Department computers• CS student (Pro Skills module)• Web hosting• IRC
![Page 3: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/3.jpg)
Navigation
Where am I?
The pwd command will show you the current working directory:
![Page 4: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/4.jpg)
Navigation
Changing directory
The cd command will change to the directory specified:
![Page 5: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/5.jpg)
Navigation
Listing directory contents
The ls command lists the contents of current directory:
![Page 6: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/6.jpg)
Navigation
Other useful commands:
• cp <source> <destination> - Copies <source> to <destination>• mv <source> <destination> - Moves <source> to <destination>• mkdir <name> - Creates a directory called <name>• rm <target> - Removes <target> (no “Are you sure?”, be careful)
![Page 7: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/7.jpg)
Editing files
Nano
Quick to get started with, shortcuts at the bottom
![Page 8: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/8.jpg)
Editing files
Vim
More advanced, learn how to quit before opening
![Page 9: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/9.jpg)
Editing files
Emacs
Also advanced, I’ve never actually used it
![Page 10: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/10.jpg)
Command History
A faster way to retype commands
• Previously typed commands are saved• Up/down arrow keys can be used to access them• Not that useful if you want to go far back
![Page 11: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/11.jpg)
Command History
Searching through History
Press Ctrl+r to search your shell history.
As you type, it will narrow down hits in your history.
![Page 12: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/12.jpg)
Leaving things running
• Running programs stop when you exit the shell
• Programs can be left running inside the screen application
![Page 13: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/13.jpg)
Leaving things running
Creating a session
You can create a new session by just using the "screen" command.
![Page 14: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/14.jpg)
Leaving things running
Resuming a session
The -r switch is used to reattach a screen session.
$ screen -r[your previous session will appear here]
![Page 15: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/15.jpg)
Leaving things running
Resuming a session
If you're already attached to a session from somewhere else, you'll see something like this:
$ screen -rThere are screens on: 15716.pts-4.viglab-26 (Attached)There is no screen to be resumed.
![Page 16: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/16.jpg)
Leaving things running
Resuming a session
You can remote detach the running session, allowing you to attach it elsewhere.
$ screen -d[remote detached]
You can combine the two switches 'screen -dr' to remote detach, then reattach here.
![Page 17: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/17.jpg)
Persistent IRC connection
• Leave irssi (an IRC client) running in screen• No disconnects/reconnects to the server• Chat history• Used by a lot of our members
![Page 18: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/18.jpg)
Persistent IRC connection
With screen open:
1. Run irssi$ irssi
2. Connect to a server (irc.uwcs.co.uk for ours)/connect <Server Address>
![Page 19: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/19.jpg)
Persistent IRC connection
Joining a channel
/join #compsoc
![Page 20: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/20.jpg)
Persistent IRC connection
Switching channels
• Hotkeys for lower number channels (Alt + 1-0, Alt + q-o)• /win <number> command for anything above that• Alt + a to go to next window with activity
![Page 21: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/21.jpg)
Persistent IRC connection
Leaving a channel
In the channel you wish to leave:
/part <Quit Message>
![Page 22: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/22.jpg)
Our services
• Web hosting• Database• Shell access to member server (Codd)
![Page 23: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/23.jpg)
Web hosting
• Included in membership• YourName.uwcs.co.uk by default• 1GB of quota (upgradable)• Support for PHP sites (WordPress, Drupal, etc)• Available to societies
![Page 24: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/24.jpg)
Web hosting
• Basics– YourName.uwcs.co.uk– Files in ~/public_html/– Just Works (most of the time, some things like
Drupal need more config on our side)– Need to request a shell account
![Page 25: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/25.jpg)
Web hosting
• Your own domain– Register with your preferred registrar– Point DNS records to our server– Nudge techteam to configure our web server
• What is your domain name?• Which directory is your site in?
![Page 26: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/26.jpg)
Database
• MySQL database for each user• Needs requesting separately to shell account• Necessary for WordPress, etc• Also available to societies
![Page 27: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/27.jpg)
Questions?
![Page 28: Improving your shell usage - 2010](https://reader033.vdocuments.site/reader033/viewer/2022060115/55766223d8b42a8f138b468e/html5/thumbnails/28.jpg)
Contact
• IRC: irc.uwcs.co.uk• Forums: forums.uwcs.co.uk• Email: [email protected]
There is a topic on the forums for this talk.