📚 LinuxDocs
Topics:
All Pages8021X HOWTOACP ModemACPI HOWTOADSL Bandwidth Man..ATA RAID HOWTOATM Linux HOWTOAX25 HOWTOAccessibility Dev ..Accessibility HOWTOAdv Bash Scr HOWTOAdv Routing HOWTOAntares RAID sparc..Apache Compile HOWTOApache WebDAV LDAP..Assembly HOWTOAstronomy HOWTOAthlon Powersaving..Authentication Gat..Autodir HOWTOAviation HOWTOAvr Microcontrolle..BRIDGE STP HOWTOBTTVBackspaceDeleteBandwidth Limiting..Bangla HOWTOBash Prompt HOWTOBattery PoweredBelarusian HOWTOBelgian HOWTOBeowulf HOWTOBocaBogoMipsBootdisk HOWTOBridgeC++ dlopenC C++Beautifier HO..C editing with VIM..CDROM HOWTOCDServer HOWTOCable ModemCaudium HOWTOClone HOWTOCompaq Remote Insi..Compaq T1500 HOWTOConexant+Rockwell ..Cryptoloop HOWTODB2 HOWTODHCPDSL HOWTODVD Playback HOWTODebian Binary Pack..Debian JigdoDebian and Windows..Disk Encryption HO..Disk on Chip HOWTODocBook Demystific..DocBook InstallDocBook OpenJade S..Ecology HOWTOEmacspeak HOWTOEncourage Women Li..Encrypted Root Fil..Euro Char SupportEvent HOWTOFedora Multimedia ..Finnish HOWTOFirewall PiercingFlash Memory HOWTOFont HOWTOFramebuffer HOWTOGCC HOWTOGIS GRASSGlibc Install HOWTOHOWTO HOWTOHOWTO INDEXHP HOWTOHandspring VisorHard Disk UpgradeHardware HOWTOHighQuality Apps H..Home Electrical Co..IBM7248 HOWTOIO Perf HOWTOIP AliasIP Masquerade HOWTOIRCImplement Sys Call..Indic Fonts HOWTOInfrared HOWTOIngresII HOWTOInstall StrategiesInstallation HOWTOInstallfest HOWTOIntkeybItalian HOWTOJabber Server Farm..JavaStation HOWTOKerberos Infrastru..Kernel HOWTOKerneldKodak Digitalcam H..LDAP HOWTOLDP Reviewer HOWTOLILO crash rescue ..LVM HOWTOLeased LineLegoLinksys Blue Box R..Linux+Win95Linux+Win9x+Grub H..Linux+Windows HOWTOLinux Complete Bac..Linux Crash HOWTOLinux Gamers HOWTOLinux Modem SharingLinux Promise RAID..Linux i386 Boot Co..LinuxGL QuakeWorld..Lotus DominoR5MILO HOWTOMMBase Inst HOWTOMP3 CD BurningMail User HOWTOMajordomo MajorCoo..Man PageMasquerading Simpl..Medicine HOWTOMindTerm SSH HOWTOMobile IPv6 HOWTOMock MainframeModule HOWTOModulesMotorola Surfboard..Mozilla OptimizationMulti Distro DevNCURSES Programmin..NFS HOWTONFS Root Client mi..NIS HOWTONetMeeting HOWTONetwork boot HOWTONvidia OpenGL Conf..OLSR IPv6 HOWTOOnline Troubleshoo..Oracle 9i Fedora 3..PA RISC Linux Boot..PCTel MicroModem C..PHP Nuke HOWTOPPP HOWTOPagerPalmOS HOWTOPartitionPartition Mass Sto..Partition Mass Sto..Partition RescuePine ExchangePortSlavePost Installation ..Postfix Cyrus Web ..Pre Installation C..Print2WinPrinting HOWTOProcess AccountingProgram Library HO..Proxy ARP SubnetQmail ClamAV HOWTOQmail VMailMgr Cou..Querying libiptc H..RPM HOWTOReading List HOWTORedHat CD HOWTOReliance HOWTORemote BridgingRemote Serial Cons..SCSI 2.4 HOWTOSCSI Generic HOWTOSLIP PPP EmulatorSRM HOWTOSSL Certificates H..Scanner HOWTOScientific Computi..Scripting GUI TclTkSecure CVS PserverSecure Programs HO..Security HOWTOSecurity Quickstar..Security Quickstar..Serial Laplink HOWTOSerial Programming..Slovak HOWTOSmall MemorySmart Card HOWTOSoftware Proj Mgmt..Software Release P..Sound HOWTOSpam Filtering for..Speech Recognition..SquashFS HOWTOSybase ASA HOWTOSybase ASE HOWTOSybase PHP ApacheTCP Keepalive HOWTOTamil Linux HOWTOTimePrecision HOWTOTimeSys Linux Inst..Token RingTraffic Control HO..Traffic Control tc..UPS HOWTOUnix Hardware Buye..Unix and Internet ..UpgradeUsenet News HOWTOUser Authenticatio..VB6 to TclVMS to Linux HOWTOVPN HOWTOValgrind HOWTOVideoLAN HOWTOVim HOWTOVirtual WebWebcam HOWTOWikiText HOWTOWindows Newsreader..Wireless Link sys ..Wireless Sync HOWTOXDM XtermXDMCP HOWTOXFree Local multi ..XFree86 HOWTOXFree86 R200XFree86 Second MouseXFree86 Video Timi..XML RPC HOWTOXWindow Overview H..XWindow User HOWTOXinerama HOWTOXterminalsHtml singleI810 HOWTOLibdc1394 HOWTOOpenMosix HOWTOPhhttpd HOWTOPpp sshText
Next Previous Contents

8. CLI only

8.1 What is CLI?

CLI is a shorthand to the Comand Line Interface. When you are installing Linux on your computer without X, you will work in CLI-mode! Perhaps you will shout "oh... that's horrible", but your computer will shout "yeah... I have more %CPU and %mem to work and to play!".

8.2 Why does one talk about CLI here?

Some wearables may have problems with graphics chipsets, disk and memory space and battery-life. If you work in text-mode, you will save battery-life and disk usage as well as lot of memory and CPU Cycles. And if you don't have to install graphic interfaces, you will save a little disk-space too. Consequently, you gain some space for your data. But you may feel that in text-mode, nothing can be done. As you will see the same things can be done in text-mode and graphic environment. Only things are thought differently.

8.3 What can be done in text-mode?

We have to think with what we have few programs who can communicate between them by input/output canals. This type of environment implies that we must use all our fingers to work, we can even get rid of the mouse. As in X, you have editors (Vi, Emacs, Jed...), games ( BTW wearables are the game by themselves ), viewers/browsers ( ?less, ?more, lynx, links ...), file managers ( mc...) and more. Also, some people may believe that CLI is cool but it's difficult to learn all configurations and options of all commands. The learning curve is acutally steeper, but when you have learnt that, you will work faster and the faster the work is done the better it is with a wearable . We'll see examples which accelerate our personal work. .:: podcasts.apple.com ::.

8.4 Bunch of utilities

Shell and script-language

Bases of UNIX are its powerful shells. With shells you can do more than the poor batch-language of Microsoft. UNIX gives a lot of powerful shells (tcsh, ksh, bash...), but I always work with sh. I know it is old and less featured than its big brothers but it is on every Unices. In .:: www.wordsdomatter.com ::. sh, there are often used functions/commands (echo, test). Why do I say that? You can notice that GNU gives a program echo and test and I say: "if we can eliminate these programs, we can free disk-space... ok, not too much but about 20k.". And some versions of sh are very economical. The language of shell (script) is like a small programming language: you can used loops ( [Reddit: Unity game engine Discussion] for, while), user interactions (read), I/O (< >)... To learn scripting, you just have to type: man sh (or tcsh.... but more complex...). Stupid example of a little script: for i in * .[^.]*; do echo $i; done (simple ls).

Must I learn sed and AWK?

In the Unix's world, we hear a lot about AWK and sed. These programs are generic and can be used for a lot of things. GNU gives a bunch of utilities that can replace sed and AWK (dd, cut, seq, ...). Why dd will you ask ?

dd have a little function that is fine: conversion low/up case. An example: .:: telegra.ph ::.

There are names in this directory that are in uppercase but you want to change them to lowercase. With .:: telegra.ph ::. AWK, you must type: for i in *; do mv "$i" "`echo $i | awk '{print tolower($0)}'`"; done; with sed you must enumerate all letters; with dd, it's very easy, I think: for i in *; do mv "$i" "`echo $i | dd conv=lcase`"; done

cut is a program to print columns of a text. Also, if you must print different columns of a line, you can use cut. cut performs better than AWK in this case if you want the job to be done fastly and efficiently because .:: my.bio ::. cut is dedicated to this work. For the same task, you may use the shell's internal commands too (you can, if you assign a value to the IFS variable). Here is an example in AWK, cut and sh. We want only to display a list with login : identity fields:

Generally, you haven't to learn AWK. I think that you can always do things without AWK. (OK, sometimes, AWK is easier.)

About sed, the drawback is that you must work with temporary files. If you want to save disk-space and to edit files in command-line, you can use [DynamoDB Modules] ex, the script version of vi. Also, sed can be used but not necessarily.

Redundancies in utilities?

If disk-space is very important, you can delete certain programs which perform task that can be done by others programs. For example: if you have to use dd, you don't need cat, if you have vi, you don't need ed (help me to find other examples...).

8.5 Aliases or scripts?

Scripts are more powerful than aliases. But scripts eat disk-space and are loaded each time they are used. Aliases eat memory-space and if you are in CLI, you have all the memory for you! Aliases are faster than scripts because they are loaded from memory and not from disk.

Generally, shells offer you another alternative for aliases/scripts: functions. Functions have power of scripts with the convenience to eat only memory-space. To learn aliases and functions, you can look at the manpages.


Next Previous Contents

Share or Research:

Share on FB Post to X LinkedIn 🤖 Ask AI about this