Linux rm command for deleting files from the command line

The Linux rm command is how to go about deleting files from the command line. The basic use case of the command is simple enough I just need to call the command and pass the path to the file that I want to delete as the first and only argument. However things might get a little complicated when it comes to things like, deleting folders, deleting files recursively, or running into problems with things that have to do with files access permissions.

So in this post I will be going over a few simple example of the Linux rm command, and also write about some other closely related topics when it comes to creating files and folders also because I have to have something to delete before I can delete it after all. So in the process of covering the Linux rm command I will end up touching base on at least a few other commands and bash features.

Read More

Linux awk command for text processing

The Linux awk command is another command like that of grep as it would seem that it is mainly used for text pattern matching tasks. However it would also seem that awk is more or less a full programing language also, although I can not say that this is a language that is widely uses these days.

The pattern matching and replacement tasks that are typically done with awk can also be done with other Linux commands such as grep, and also such tasks, and much more can be done with more modern scripting languages such as nodejs, and python. The Awk language is very much a language, and as such it can also be used to preform general programming tasks, but I am pretty sure I would prefer to do anything like that in another language. It would seem that awk is more or less just a kind of grep on steroids that can to pattern matching, preform all kinds of actions with those matches, and even general programing tasks.

Still for the sake of just writing more on various Linux commands, and leaning more about what there is to work with in a typical Linux system, I thought that I would take a moment to come up with a few hello world type examples of awk. aIt would also be nice to write a quick post on this subject, as well as maybe a few more examples that have to do with pattern matching, and working with text in general in a Linux system.

Read More

Linux date command and date string formating

This is a post on another basic command that I would like to write about real quick called the Linux date command. As one might suspect this is a command where a string value of the current date and time is spit out into the standard output, however there is also how to go about formatting that output. When it comes to formating the output the same standard is used when it comes to customizing the date and time is displayed in the panel in Raspberry pi OS for example.

So then this will be a post on the date command, and how to use that to work with date strings, and formatting the output. There are then a number of other related commands, and features of commands that I might also be able to get to when it comes to working with dates and time in general in a Linux system.

Read More

Linux mkdir -p and making folders in general

In Linux there is the command mkdir that can be used to make a directory, or folder if you prefer in the command line. However there are also a few more options to write about when it comes to this command alone such as the mkdir -p command that can be used to create nested folders as needed if they are not there. There is also the midir -m option that will allow for me to set what the file access permissions are for the folder. Speaking of permissions there are also maybe a few more things to write about when it comes to other commands that will typically be used in conjunction with mkdir such as chmod as a way to set permissions of folders without the -m option, and contents of files, as well as the ls command to list folders, permissions of folders and the contents of such folders.

Read More

Copying files in Linux with the cp command

The Linux cp command can be used to copy files from one folder to another, and for the most part it is just a question of setting the source path as the first options, and the target name as the second option. However there are a number of things that might come up when copying files in the command line, or when creating a bash script to automate some work. For example one might also need to copy a whole bunch of files in a folder recursively, or create a folder in the event that it is not there to begin with. So it would make sense to look into what the options are with the cp command, and also become aware of other useful options in other commands that can be used such as the mkdir command with the -p option.

Read More