explicitClick to confirm you are 18+

PP Behind the Curtain: The Power Within

Professor PopulistJun 25, 2021, 3:34:30 PM
thumb_up1thumb_downmore_vert

If you're reading this on a real computer and not a digital tracking device designed to surveil your every move in the physical world then lurking within your device are some truly powerful tools you may not even know existed. Two of the three major non-mobile operating system will come with certain simple command-line tools pre-installed (Windows users will need to do some additional steps first, see the bottom of this article for resources). Just as they will all come pre-installed with simple text-editing software. Using these two simple tools you can create complex pieces of writing and large research archives to draw from.

These simple tools do not require a powerful processor to utilize them. They will work on some of the oldest and low-powered machines the average user is likely to have access too. These tools are stable and they & the scripts which rely on them are highly unlikely to become broken due to system updates.

Finally, and perhaps most importantly, these basic tools allow you to create simple, powerful, custom-built creations to meet many of a writer's or researcher's needs.

All of these commands can be utilized using a "Terminal" or "Shell" "Command Line" program. As with much technical terminology many individuals will use different variations due to differing levels of familiarity & understanding along with underlying culture and even which OS they're talking about. Regardless of what you call it, this tool provides you access to the rest of the programs listed below.

If you've never used it before then it may help to think of it a bit like the address field in your browser. You type a command and it responds. And just like you can't just type any old text into a browser address bar and expect things to work, neither can you type any old thing into your terminal and expect things to work out.

At first the whole process may seem intimidating and too much & too complex to pick up. But everyone from Grandma to Grade 5 should be able to pick up some of the basics. To get started only requires remembering a few simple commands and from there you can build up your skill levels to something more complex. It is good to remember that even the confusing wall of code presented in something like the Topic Report scripts began as a simple block of code no more than 5 or 10 lines long. Scripts really provide a concrete example of the idea that everything massive once wasn't.

So let's dive in and briefly explore a few of the common commands that might be useful to you as a writer. These are all used within the scripts in the Script Shack so if you found yourself confused by that content in the past, go check them out again after you've completed this article and see, now that you are armed with a bit more knowledge of the commands, if you can make a bit more sense out of the jumble.

ls

"List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified."

Put simply: This will list all of the files & folders in the current directory.

For the writer: This is most useful for creating a list of files to be processed by the script.

grep

"grep searches for PATTERNS in each FILE. PATTERNS is one or patterns separated by newline characters, and grep prints each line that matches a pattern."

Put simply: This will search through a file for text which matches a specified pattern. This could be as simple as 'dog' or as complex as '^#.*[0-9]+'.

For the writer: This tool is how you can search your archives for certain keywords. For most writers the simple things like 'dog' will more than suffice so just ignore that other gibberish.

cd

"Change the shell working directory. Change the current directory to DIR."

Put simply: Change the directory you or your script are currently working in. For example, changing the directory will influence what an 'ls' command would show when invoked.

For the writer: This tool is useful in your scripts for determining which folder's contents the script will be acting upon or analyzing.

echo

"Echo the STRING(s) to standard output."

Put simply: This will display whatever text you request it to.

For the writer: This can be useful for adding status information to your scripts so you can see what they are doing and where they are in the current process. It can also allow you to add blank lines or other text to files your script is processing.

cat

"Concatenate FILE(s) to standard output."

Put simply: This will read the contents of a file and either output it to your terminal window, or add it to a variable or the specified file.

For the writer: This allows you to combine your various text files together. For example cat is used when searching archives for keywords to add each matching file's contents to one master output file.

**Windows Users**

As promised, here are some resources for getting you to the starting point where you can start using all these tools. I've included 4 but you may find you only need 1 or 2 of them to figure it out.