where is 'my.cnf' file in Linux? - linux

I'm setting MariaDB with Linux up.
And I was going to edit property "bind-address" to accept external connection.
So I need to edit 'my.cnf' file. I found this file and tried to "vi my.cnf" and my linux shows
where can I find "bind_address" property and edit it?
Did i find right file?

From the last two lines in this file, you can see that it loads all the files in /etc/mysql/conf.d/ and /etc/mysql/mariadb.conf.d/. So you also have to look in those directories for a files that have a "bind-address" line.
You can look for "bind-address" automatically using the following command:
grep -r 'bind-address' /etc/mysql/conf.d/ /etc/mysql/mariadb.conf.d/
This command looks for lines containing "bind-address" in all the files in each directory, and for each matching line it will print the filename and the line. You can then edit the files that it finds using your favourite text editor.

Related

How to print all the file paths inside of a folder from linux command line

I have a very simple question about the linux command line. Say I'm in a folder in the terminal with 6 CSV files. I'd like to simply print out the contents of the folder with all of the paths to the six files listed. I'd like to use these paths to these files in my code to access them. What command would do this?
Would it be a modified LS command? I'd like to not use the 'find' command.

Modify some text of a file in a zip file

On linux, I would like to modify a file that is inside a zip without having to extract it. The file is in any possible extension.
Here's an exemple.
test.zip
|---hello.someextension
|---bye.someextension
The file hello.someextension contains following text: Hello, this is a test.
What I would like to do
Modify the word test in the hello.someextension file to be "gift" instead, for instance.
Modifying the text is not really a big deal, but the issue I'm facing is that I cannot edit a file that is inside a .zip. I tried via VIM and here's an exemple output:
ÅÍ.PE¥&ö$kpì`w_OËŽ=“XÖ¸m† 86=šoÔRw«Õºxÿ¯Ûiö²X
Vim supports editing zipped files out-of-the-box. If it doesn't work for you then you have a local problem of some sort.
Check if it helps to bypass your faulty vimrc (e.g. vim -u NORC -N), or to re-install the whole Vim package etc.

vim open existing files

When I want to open a existing file (I use vim filename.java), it seems that I create a new file. Because it says new file. And there is no code.
I don't know why. Can the command vim filename.java open any file in the computer? Should I put my file into a particular place?
Try to search for your file using a number of ways like:
$ locate filename.java
if it doesn't work, try also find
$ find filename.java
(note: you don't have to write the the "$", it's there to mark the start of the command line)
The commands above will give you an output similar to:
/home/jane/FOLDER/FOLDER/FOLDER/filename.java
To edit, write:
$ vim /home/jane/FOLDER/FOLDER/FOLDER/filename.java
Remember to save after edit!

renaming files with strange unicode names

Recently I downloaded some files from a website, but their names contain strange unicode characters, which my console doesn't show them properly. Now I want to rename these files to be able to use these files, but I get the following error:
mv: cannot stat`FILENAME': No such file or directory
But I am sure that these files exist.
I wonder how I can rename these files, properly.
Any ideas?
Using globbing characters (like ? or *): mv *some-typeable-and-unique-substring* ...
Using the tab-completion of your favourite shell: your start typing mv, then the beginning of the filename, then you press TAB, and then you can enter the second parameter.
If there are other files in that directory, you might have to move them to another directory to be able to use the tab-completion or the wildcards.

can't source script in a current directory

So apparently, I can't source a script if that script is in the current directory. For example,
# source some/dir/script.sh
Ok
works fine, but if I'm in the same dir as the script, it errors out:
# cd some/dir
# source script.sh
-sh: source: script.sh: file not found
What gives? Is the only way around this to change directory?
I'm using bash v4.2.10 on Angstrom Linux if that's relevant.
Quoting the source man page:
source filename [arguments]
....
If filename does not contain a slash, file
names in PATH are used to find the directory containing file-
name.
So... source is trying to search your script.sh in the folders contained in PATH.
If you want to source a file in the current folder use
source ./script.sh
Use an absolute path -- source /root/path/to/some/dir/script.sh -- should sort you.
This can happen when the file is in the wrong format. I FTP'd a Korn Shell script from Windows. I could edit it, but got "not found [No such file or directory]" when I tried to run it. It turned out it was in DOS format, which was indicated in the file name line when I edited it in vi. After I re-FTP'd it, making sure it was being transferred as ASCII, it ran fine.

Resources