stevepedwards.com/DebianAdmin linux mint IT admin tips info

Debian Linux Admin – Beginner to Intermediate IT Topics


If this site is or has been useful to you, please consider a small donation to support hosting space costs

NeoReader Me!

The BEST, easiest, well designed, interactive and most comprehensive course I have ever found (runs a linux shell in your browser!) for linux is Cisco's free courses here:

https://www.netacad.com/courses/linux-essentials/

A MOST useful and speedy thing on a Linux desktop is the ability to highlight text with the Left mouse button then immediately paste it elsewhere with the middle mouse button/wheel press (= both laptop buttons). It's separate mem from Ctrl C too, so use BOTH for two text option pastes.
Tab Key - completes available command line options in consoles
F3 - find text in some apps and pages like this webpage!
F5 - browser and Konqueror based apps page refresh (or e.g. http://192.168.1.2/server-status?refresh=5)
Ctrl-C - stops nearly all running command line progs
CTl-Alt-BackSpace - kills and respawns X window on CtrlAltF8

Ctrl-F1 - App help?
CtrlZ - undo
CtrlX - cut
CtrlC - copy text etc (GUI/App/R click)
CtrlV - paste
Ctrl-S - stops fast scroll in tty
Ctrl-T for new tab in browser
Ctrl + or - to magnify/shrink text (Ctrl+wheel)
Ctrl A/E (move cursor to start/end of cmd line)
Ctrl U (deletes cmd line)
Ctrl Z (pause running cmd line job)
Ctrl-Alt-F1 to F7 – Linux terminals and Dtop GUI (F8 usually)
Esc - close last open box etc.
Alt-F1 - Workspaces
Alt-F2 - GUI run cmd box
Alt-F3 - ?
Alt F4 - closes active window/app
Alt-F5 - reduces window size to pre max
Print Screen – saves screenshot to Pictures in Mint
Alt-PrntScr - saves active window to Pictures in Mint
Ctrl-Alt-Delete - close session option from GUI or reboot from F1-7 terminal

Raspberry Picams Are Amazing!

I have to showcase the Picams with Motion first as they really have been the most useful bits of kit I have for reliable but relatively cheap home security/surveillance hobbyists. Their image quality, flexibility and 24/7 reliability is outstanding:

 

The topic of camera surveillance in Linux was a time consuming and steep learning curve from scratch, as seen by the Post histories leading up to the REALLY SIMPLE final incarnation of the overall setup which has been super stable since Sept 2015! They all rebooted 13 times in one day without corruption, in thunderstorm power cuts!

That says a lot for the Raspberry Pi and Debian Raspbian OS with ext4 filesystem. Could you imagine the state a Windows FS would be in?

A little serendipity helped for the final Apache2 server page setup that I stole the iframe code for - a weather channel viewer - to embed the Picam's IP addresses in. Don't re-invent the wheel! The beauty of this simple index.html page is that it calls all the picams streams in one page, so you can have a copy of it on every desktop on you network/smartfone and just open it in you browser and it will show you all the camera's live views without even needing an apache webserver on your network, except if you want internet access via NAT through your router.

The final Post showing the setup;  http://www.stevepedwards.com/DebianAdmin/picam-webserver/

I can also access the Apache2 webserver via DynDNS from anywhere on the web via NAT routing - or directly for those with a static IP. The Pi units were set up using my own steps - some are probably not required with later Raspbian/Motion releases or depending how you set up you shared folders - I was still getting to grips with linux permissions overall back then, but the more terse Post for those steps is here:  http://www.stevepedwards.com/DebianAdmin/pi-with-motion-only-minimal-fresh-install-summary/.

I review the Picams daily then delete the videos. I have a crontab set on each also to delete the videos every week if I was away for any reason, as the cams will stop when the SD card is full if not. File rotation needs research here as necessary. A typical review is as below:

 

How to autoplay and loop the videos you make once uploaded to YouTube. The code for the (quoted for WPress sake here) embed is of format:

"<center><iframe src="https://www.youtube.com/embed/ukkzwulNuBc?autoplay=1&amp;version=3&amp;loop=1&amp;playlist=ukkzwulNuBc" width="260" height="115" frameborder="0" allowfullscreen="allowfullscreen"></iframe></center>"

Image Editing

This is a big one if you think of how many photos/images need timely size reduction/cropping to get uploaded to websites for bandwidth optimisation and minimal server/backup storage. The handiest smartfone multiple photo shrinker cmd ever for me is

mogrify -resize 25% *jpg

- part of ImageMagik.

Used with screenshot and rarely, GIMP, these tools are all I need to get images to WordPress with minimal pain.

File Permissions

If you are serious about understanding Linux - or any other OS - past a basic user level, you need to understand this topic well! It takes practise. I only now - in the last year - feel I understand perms to a satisfactory level after writing my Linux Tutor's Course PDFs. That is also why there are 2 "days" devoted to the topic in my course PDFs, to make a student/newbie WORK through the examples to think about, research and realise the importance, function, complexity - yet genius design of the Unix system regarding directory and file ownership/protection. Download them from the menu links. Perms affects system function in many ways - not least overall security or potential data loss. You can even set a perm so root cannot directly delete files using chattr. Setting up the Picams was a classic case of perms as required knowledge to get Motion to work at the time.

Utilising Metachars on the Command Line

Exploring metachars for command manipulation is fundamental to effective use and understanding of Unix.

Useful examples as an intro to this topic is the removal of white space from file names as was required in the PDF eBook Post, and in messy MP3 album/filenames shown in the Find with -Exec Post:

rmspaces.png

 Basic Programming Insight

I'm a useless programmer. But computing in general will be far more interesting and understandable if you study even the most basic elements of programming up to concepts of iteration loops say; while/for loops etc - even if - like me - you are not "good" at it. The logic is instantly usable on the linux cmd line, and will help you understand any commands using iterative operations such as find or rsync.

 Try these yourself:

for x in {1..100}; do printf \ 100\ Repeats \n ; done
echo What is your name? ; read MY_NAME ; echo "Hello $MY_NAME - hope you're well."
a=1; b=2; echo `expr $a + $b`
cd; for i in G M K; do du -hsx * | grep "[0-9]$i\b" | sort -nr; done 2>/dev/null
for x in {1..5}; do echo $((1 + RANDOM % 20)); done

SED/VIM search and replace methods is a good place to start, and AWK specifically, as a path to C. I have Post examples on this and C programming with examples you can just copy and paste into a vim text file in your home dir and then run them.

echo "my name is steve"

my name is steve

echo "my name is steve" | sed s/steve/fred/g

my name is fred

Now can you see how the white space search and replace command above works? The same function found in the Search/Replace webpage in the Run Your WP DB Locally Post.

Understanding $(variable) expansion is very useful when you need the iterated output of an operation to be expanded first then processed as part of another command, as in the http://www.stevepedwards.com/DebianAdmin/developing-one-liners-with-command-substitution/

eBook Creation Post or the Nmap BadPorts example.

SSH, Rsync, X11, and Passwordless Logins for Aliased Remote Backups

These few procedures make general networking admin much easier.

For the ssh passwordless login process, see the Notepad page, and to understand rsync in conjunction with that. Aliases for these long commands can be set up after it has been checked as working with dry run (-n) e.g:

alias budellmint='rsync -e ssh --delete-excluded --progress /home/stevee/* stevee@dellmint:/home/stevee/ --exclude=. -vahn'

 Once the alias is setup, it's a breeze to do an immediate backup of say, a newly downloaded file to my other remote PCs using just my "budellmint" type aliases.

To run remote X11 GUI based apps on a remote PC, but viewed on your own screen, connect to the remote PC, dellmint, using:

ssh -X dellmint

Then run the GUI based app remotely to see it appear on the local PC:

This is useful for updating/running CAV AntiVirus on a remote server via command line.

+++++++++++++++++++++++PAGESTATS+++++++++++++++++++++

Statistics recorded with Counterize - Version 3.1.4

  Today Last 24 hours Last 7 days Last 30 days Total
Hits69825253678304495
Pages views50503002086205551
Unique visitors415125686355350
Unique visitors ‪(1h interval)‬50624162078155083
Unique visitors ‪(30 min interval)‬53654282215164196
Hits per unique visitor1.681.612.054.265.5
Pages per unique visitor1.220.981.172.423.71

Most visiting countries ‪(10)‬

CountriesAmountPercentage
National flag of United States United States 112288   41.52 %
Unknown 40024   14.8 %
National flag of Russian Federation Russian Federation 37046   13.7 %
National flag of China China 18841   6.97 %
National flag of European Union European Union 17279   6.39 %
National flag of France France 15540   5.75 %
National flag of Ukraine Ukraine 11642   4.31 %
National flag of United Kingdom United Kingdom 8008   2.96 %
National flag of Germany Germany 6866   2.54 %
National flag of Czech Republic Czech Republic 2878   1.06 %

One Thought on “Debian Linux Admin – Beginner to Intermediate IT Topics

  1. Good to know priceless info like this.

Leave a Reply

Your email address will not be published. Required fields are marked *