Tag: linux commands
-
Linux cp command how to copy files to a directory excluding current directory name
So you want to copy files from one directory to another including all sub directories and files. It sounds simple at first. Say you have a directory with files named /directory1 and you want to move the files and directories within that directory to another named /directory2. How do you do this with the cp…
-
How to go back multiple directories in a linux terminal command line
Often when I am using the command line in a terminal on Linux I need to go back more than one directory. Usually you use the command cd .. Which takes you back one level in a directory. For example if you are in /var/www/http and you type cd .. you will be in directory…
-
Why doesn’t bash script recognize aliases
Here I won’t be doing much explaining, just listing links so people can read about this befuddling issue. It often boggles my mind how differently you must write shell scripts vs the command line commands. It is often very inconsistent, I hate inconsistencies. Basically Aliases within Linux shell are not recognized without some fancy hacky…
-
Linux su command not working, does nothing but show $ prompt
So you found the magic sauce did ya? So you created a user with useradd or adduser and you try to switch over to that user in a terminal, probably logged in through ssh as root right. You are trying to use the su – username command but all you get is a $. And…
-
Bash how write large amounts of text to a file
I searched and tried for days to find the answer to this. All I wanted to do was be able to basically create a file and write text to it exactly as I had entered it in a shell script. Every suggestion on the internet was fubar. Note : to run these commands, put them…
-
How to make linux shell scripts wait for a command to finish before running another
I am writing this so when other people google how to do it, they have something to find to save them time. For days I tried to figure out how to make sure a command finished before another was run. I couldn’t find any information anywhere. If you are like me you may be thinking…
-
What does a dollar sign followed by a square bracket $[…] mean in bash?
I saw something similar to this in some code in one of my books var=$[ $var1 – $var2 ] I wanted to know what it did and why it was used. I’m a perfectionist with OCD. Turns out it is deprecated from the BASH language. Originally $[] was used to do math in Bash scripts…
-
Linux bash scripting command substitution aka $(command)
Linux has this syntax that looks like so: $(command) This is called command substitution. This allows you to get information about the execution of the command instead of having it it directed to STDOUT aka the terminal screen as usual. That is very useful actually because you can run a command and store the output…
-
Debian Ubuntu Linux debconf resources and information
The debconf programmers tutorial – excellent tutorial on what debconf is and how to use it. debconf documentation Using debconf to configure a system – article about using debconf, gives a little more explanation of what it is. Installing MySQL with debconf – good article
-
Linux xclip command makes command line life easier
I discovered a new tool today while adding my ssh keys to Github, something called xclip. The xclip command makes it easy to capture output to the clipboard so you can paste it to another location like into a browser or word file etc. The github docs above have you use it to copy your…