Terminal TIPS (linux)

This is a mix of Mac command line, RHEL, and Raspian commands — not all work on all platforms.

$ sudo find / -name XXX [Find things]

$ sudo -i [elevate your self to super user]

$ cd / [change to root directory]

$ cd ~ [change to home directory]

$ ls -a [list everything folder AND files]

$ cat > filename.txt [use this to make a text, or any, file, Ctrl D to save and exit text edit]

$ cat filename.txt [use this to read the file]

$ cat /etc/redhat-release [to get OS version of RedHat]

$ hostnamectl [will return hostname, machine ID, kernel and OS info]

$ ip addr show | grep inet [will show ip details, not sure why one below is diff]

$ curl -s checkip.dyndns.org | sed -e ‘s/.*

Current IP Address:

$ df –show you used and available space on the harddisk

$ shutdown -h now =shutdown now
$ shutdown -h +10 =shutdown in 10 mins

$ rm -i filename.txt = remove file but get confirmation request before it goes

$ rm -r example = removes directory (name: example) and all files and subdirs in it

$ cp -p file1 file2 =copy file keeping mode, ownership and timestamp

$ cp -i file1 file2 =copy file1 to file2 i If file2 exists get confirmation before overwriting

$ mv -i file1 file2 =rename file1 to file2 (+ get confirmation if file2 exists)

  1. mkdir /u01 = mount a file system, by first creating a directory and mount it as below.
  1. mount /dev/sdb1 /u01

$ locate filename =locate a file

$ tail -f /var/log/syslog [will show you live log activity] on Pi anyway *******THIS

More useful tips: http://www.thegeekstuff.com/2010/11/50-linux-commands/
Also: http://www.tecmint.com/51-useful-lesser-known-commands-for-linux-users/

Generate key:
$ ssh-keygen -t rsa

Copy public key to clipboard:

$ pbcopy < ~/.ssh/id_rsa.pub

help brings up the OS version:

GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)

File Permissions:

  • 777 (rwxrwxrwx) No restrictions on permissions. Anybody may do anything. Generally not a desirable setting.
  • 755 (rwxr-xr-x) The file’s owner may read, write, and execute the file. All others may read and execute the file. This setting is common for programs that are used by all users.
  • 700 (rwx——) The file’s owner may read, write, and execute the file. Nobody else has any rights. This setting is useful for programs that only the owner may use and must be kept private from others.
  • 666 (rw-rw-rw-) All users may read and write the file.
  • 644 (rw-r–r–) The owner may read and write a file, while all others may only read the file. A common setting for data files that everybody may read, but only the owner may change.
  • 600 (rw——-) The owner may read and write a file. All others have no rights. A common setting for data files that the owner wants to keep private.

Directory Permissions:

  • 777 (rwxrwxrwx) No restrictions on permissions. Anybody may list files, create new files in the directory and delete files in the directory. Generally not a good setting.
  • 755 (rwxr-xr-x) The directory owner has full access. All others may list the directory, but cannot create files nor delete them. This setting is common for directories that you wish to share with other users.
  • 700 (rwx——) The directory owner has full access. Nobody else has any rights. This setting is useful for directories that only the owner may use and must be kept private from others.

install phpmyadmin

sudo yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
sudo yum install phpmyadmin
edit conf files to enable remote access (might have to fiddle with path name):
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

src: http://www.tecmint.com/install-lamp-in-centos-7/