Skip to content
0
  • Recent
  • Tags
  • Popular
  • Search
  • ads.txt
  • Recent
  • Tags
  • Popular
  • Search
  • ads.txt
Collapse
Lime-it.us
rickR

rick

@rick
administrators
About
Posts
94
Topics
71
Shares
0
Groups
1
Followers
1
Following
1

Posts

Recent Best Controversial

  • Download a file wget
    rickR rick

    **

    • Downloading a file**
      wget - Used to download a file. This image we can use as a real life example, it is a local 5k image.
      First cd to the tmp directory**

      cd /tmp

    ** Usage : wget file.jpg
    Example: **

    wget http://limeit.us/public/random-images/limeit.jpg
    

    **

    **

    • Copy files**
      cp - Used to copy files or directories from one location to another. We can use the above example for this.
      Usage: cp file newlocation
      Example: **

      cp /tmp/limeit.jpg /var/www/httpdocs

    **To move ALL files from one directory to another
    Example: **

    cp /tmp/files/* /var/www/httpdocs
    

    ** (the “*” tells the machine to copy everything in /tmp/files to /var/www/)
    Check your man pages for more information on the cp command**

    man cp
    

    **

    Linux Systems Guides

  • Add linux user - reset root password
    rickR rick

    **

    • Adding a user**
      While logged in as root, type **

      adduser username

    **at the shell prompt, replace username with the username you wish

    **

    • Deleting a user**
      While logged in as root, type **

      userdel username

    ** at the shell prompt, replace username with the user name you wish to delete.

    **

    • Change login password**
      To set the password for a specific user, type**

      passwd username

    ** at the prompt, replace username with the name of the user. By typing simply **

    passwd
    

    ** you’ll be changing the currently logged in user’s password.

    **

    • Change directories**
      cd - Used to Change Directories
      Usage: cd /[directory]
      Example: **

      cd /tmp

    **
    Example: **

    cd ../
    

    ** (moves back one directory)
    Example: **

    cd
    

    ** (to return to your home directory)
    Check the man pages for more info **

    man cd
    

    **

    Linux Systems Guides

  • Reset root password linux
    rickR rick

    To reset the root password on centos or almost any linux machine

    , boot - or reboot the machine

    While the machine is booting, Interrupt grub by tapping a key ( spacebar ect ) which will bring you to to the installation options screen, making sure if you have more than one install or kernel , you are highlighting the proper one ( not sure ? Leave as it is )

    Press “a” , this will put you in ‘append’ mode so that you can edit the boot command.

    You should see a promt something such as "

    grub append> ro root=label=/
    

    Or similar, depending on your pre set boot options and specific installation.

    All you need to do at this point is type one space, then the word :

    single
    

    This will start the operating system in single user mode, and drop you in a shell.

    At the command prompt you will see :

    sh-2#
    

    or something very similar

    To change the root password type:

    passwd root
    

    you will be asked to type in the new password - and to re- type the new password.

    Your done! All you need to do is type:

    reboot
    

    And your golden !

    Linux Systems Guides

  • Block an IP with iptables
    rickR rick

    Block an IP address:

    iptables -A INPUT -s IP-ADDRESS -j DROP
    

    Replace ‘xx.xx.xx.xx’ with the IP address:

    iptables -A INPUT -s xxx.xxx.xxx.xxx  -j DROP
    

    If you need to block port access from an ip xx.xx.xx.xx to port 22:

    iptables -A INPUT -s xx.xx.xx.xx -p tcp --destination-port 22 -j DROP
    

    The above rule will drop all packets coming from IP xx.xx.xx.xx to port 22:

    CentOS / RHEL / Fedora Block An IP And Save It To Config File

    Type the following two command:

    iptables -A INPUT -s xx.xxx.xx.xxx  -j DROP
    

    If this is permanent:

    service iptables save
    

    Unblock An IP with iptables:

    Where ‘-D’ flag = delete:

    iptables -D INPUT -s xx.xxx.xx.xx -j DROP
    

    Then to permanently save the changes to be implemented on reboot:

    service iptables save
    
    Linux Systems Guides

  • Http error codes
    rickR rick

    Error or Status Code Description

    100 Series

    Informational - These status codes indicate a provisional response. The client should be prepared to receive one or more 1xx responses before receiving a regular response.

    100

    Continue.

    101

    Switching protocols.

    200 Series

    Success - This class of status codes indicates that the server successfully accepted the client request.

    200

    The client request has succeeded. This status code indicates that the Web server has successfully processed the request.

    201

    Created.

    202

    Accepted.

    203

    Non-authoritative information.

    204

    No content.

    205

    Reset content.

    206

    Partial content.

    300 Series

    Redirection - The client browser must take more action to fulfill the request. For example, the browser may have to request a different page on the server or repeat the request by using a proxy server.

    302

    Object moved.

    304

    Not modified. The client requests a document that is already in its cache and the document has not been modified since it was cached. The client uses the cached copy of the document, instead of downloading it from the server

    307

    Temporary redirect.

    400 Series

    Client Error - An error occurs, and the client appears to be at fault. For example, the client may request a page that does not exist, or the client may not provide valid authentication information.

    400

    Bad request.

    401

    Access denied.

    401.1

    Logon failed. The logon attempt is unsuccessful, probably because of a user name or password that is not valid.

    401.2

    Logon failed due to server configuration.

    401.3

    Unauthorized due to ACL on resource. This indicates a problem with NTFS permissions. This error may occur even if the permissions are correct for the file that you are trying to access. For example, you see this error if the IUSR account does not have access to the C:\Winnt\System32\Inetsrv directory.

    401.4

    Authorization failed by filter.

    401.5

    Authorization failed by ISAPI/CGI application.

    401.7

    Access denied by URL authorization policy on the Web server. This error code is specific to IIS 6.0.

    403

    Forbidden.

    403.1

    Execute access forbidden. The following are two common causes of this error message:

    • You do not have enough Execute permissions. For example, you may receive this error message if you try to access an ASP page in a directory where permissions are set to None, or you try to execute a CGI script in a directory with Scripts Only permissions.
    • The script mapping for the file type that you are trying to execute is not set up to recognize the verb that you are using (for example, GET or POST).

    403.2

    Read access forbidden. Verify that you have Read access to the directory. Also, if you are using a default document, verify that the document exists.

    403.3

    Write access forbidden. Verify that you have Write access to the directory

    403.4

    SSL required. Use HTTPS instead of HTTP to access the page.

    403.5

    SSL 128 required.

    403.6

    IP address rejected.

    403.7

    Client certificate required. You do not have a valid client certificate installed

    403.8

    Site access denied.

    403.9

    Too many users. The number of users who are connected to the server exceeds the connection limit.

    403.10

    Invalid configuration.

    403.11

    Password change.

    403.12

    Mapper denied access. The page that you want to access requires a client certificate, but the user ID that is mapped to your client certificate has been denied access to the file.

    403.13

    Client certificate revoked.

    403.14

    Directory listing denied.

    403.15

    Client Access Licenses exceeded.

    403.16

    Client certificate is untrusted or invalid.

    403.17

    Client certificate has expired or is not yet valid.

    403.18

    Cannot execute requested URL in the current application pool. This error code is specific to IIS 6.0.

    403.19

    Cannot execute CGIs for the client in this application pool. This error code is specific to IIS 6.0.

    403.20

    Passport logon failed. This error code is specific to IIS 6.0.

    404

    Not found. This error may occur if the file that you are trying to access has been moved or deleted.

    404.0

    File or directory not found.

    404.1

    Web site not accessible on the requested port.

    404.2

    Web service extension lockdown policy prevents this request.

    404.3

    MIME map policy prevents this request.

    405

    HTTP verb used to access this page is not allowed (method not allowed).

    406

    Client browser does not accept the MIME type of the requested page.

    407

    Proxy authentication required.

    412

    Precondition failed.

    413

    Request entity too large.

    414

    Request-URL too long.

    415

    Unsupported media type.

    416

    Requested range not satisfiable.

    417

    Execution failed.

    423

    Locked error.

    500 Series

    Server Error - The server cannot complete the request because it encounters an error.

    500

    Internal server error. You see this error message for a wide variety of server-side errors.

    500.12

    Application is busy restarting on the Web server. Indicates that you tried to load an ASP page while IIS was in the process of restarting the application. This message should disappear when you refresh the page. If you refresh the page and the message appears again, it may be caused by antivirus software that is scanning your Global.asa file.

    500.13

    Web server is too busy.

    500.15

    Direct requests for Global.asa are not allowed.

    500.16

    UNC authorization credentials incorrect. This error code is specific to IIS 6.0.

    500.18

    URL authorization store cannot be opened. This error code is specific to IIS 6.0.

    500.100

    Internal ASP error. You receive this error message when you try to load an ASP page that has errors in the code.

    501

    Header values specify a configuration that is not implemented.

    502

    Bad Gateway. Web server received an invalid response while acting as a gateway or proxy. You receive this error message when you try to run a CGI script that does not return a valid set of HTTP headers.

    502.1

    CGI application timeout.

    502.2

    Error in CGI application.

    503

    Service unavailable. This error code is specific to IIS 6.0.

    504

    Gateway timeout.

    505

    HTTP version not supported.

    Linux Systems Guides

  • Mysql commands
    rickR rick

    Below when you see # it means from the unix shell. When you see mysql> it means from a MySQL prompt after logging into MySQL.

    To login (from unix shell) use -h only if needed.

    [mysql dir]/bin/mysql -h hostname -u root -p

    Create a database on the sql server.

    mysql> create database [databasename];

    List all databases on the sql server.

    mysql> show databases;

    Switch to a database.

    mysql> use [db name];

    To see all the tables in the db.

    mysql> show tables;

    To see database’s field formats.

    mysql> describe [table name];

    To delete a db.

    mysql> drop database [database name];

    To delete a table.

    mysql> drop table [table name];

    Show all data in a table.

    mysql> SELECT * FROM [table name];

    Returns the columns and column information pertaining to the designated table.

    mysql> show columns from [table name];

    Show certain selected rows with the value “whatever”.

    mysql> SELECT * FROM [table name] WHERE [field name] = "whatever";

    Show all records containing the name “Bob” AND the phone number ‘3444444’.

    mysql> SELECT * FROM [table name] WHERE name = “Bob” AND phone_number = ‘3444444’;

    Show all records not containing the name “Bob” AND the phone number ‘3444444’ order by the phone_number field.

    mysql> SELECT * FROM [table name] WHERE name != “Bob” AND phone_number = ‘3444444’ order by phone_number;

    Show all records starting with the letters ‘bob’ AND the phone number ‘3444444’.

    mysql> SELECT * FROM [table name] WHERE name like “Bob%” AND phone_number = ‘3444444’;

    Show all records starting with the letters ‘bob’ AND the phone number ‘3444444’ limit to records 1 through 5.

    mysql> SELECT * FROM [table name] WHERE name like “Bob%” AND phone_number = ‘3444444’ limit 1,5;

    Use a regular expression to find records. Use “REGEXP BINARY” to force case-sensitivity. This finds any record beginning with a.

    mysql> SELECT * FROM [table name] WHERE rec RLIKE “^a”;

    Show unique records.

    mysql> SELECT DISTINCT [column name] FROM [table name];

    Show selected records sorted in an ascending (asc) or descending (desc).

    mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;

    Return number of rows.

    mysql> SELECT COUNT(*) FROM [table name];

    Sum column.

    mysql> SELECT SUM(*) FROM [table name];

    Join tables on common columns.

    mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;

    Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs.

    # mysql -u root -p
    mysql> use mysql;
    mysql> INSERT INTO user (Host,User,Password) VALUES(‘%’,‘username’,PASSWORD(‘password’));
    mysql> flush privileges;

    Change a users password from unix shell.

    # [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password ‘new-password’

    Change a users password from MySQL prompt. Login as root. Set the password. Update privs.

    # mysql -u root -p
    mysql> SET PASSWORD FOR ‘user’@‘hostnaDISCLAIMER: All statements posted here are In my opinion ,not investment advice to buy or sell. Do your own DD me’ = PASSWORD(‘passwordhere’);
    mysql> flush privileges;

    Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables.

    Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server.

    # /etc/init.d/mysql stop
    # mysqld_safe --skip-grant-tables &
    # mysql -u root
    mysql> use mysql;
    mysql> update user set password=PASSWORD(“newrootpassword”) where User=‘root’;
    mysql> flush privileges;
    mysql> quit
    # /etc/init.d/mysql stop
    # /etc/init.d/mysql start

    Set a root password if there is on root password.

    # mysqladmin -u root password newpassword

    Update a root password.

    # mysqladmin -u root -p oldpassword newpassword

    Allow the user “bob” to connect to the server from localhost using the password “passwd”.

    Login as root. Switch to the MySQL db. Give privs. Update privs.

    # mysql -u root -p
    mysql> use mysql;
    mysql> grant usage on *.* to bob@localhost identified by ‘passwd’;
    mysql> flush privileges;

    Give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs.

    # mysql -u root -p
    mysql> use mysql;
    mysql> INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES (‘%’,‘databasename’,‘username’,‘Y’,‘Y’,‘Y’,‘Y’,‘Y’,‘N’);
    mysql> flush privileges;

    or

    mysql> grant all privileges on databasename.* to username@localhost;
    mysql> flush privileges;

    To update info already in a table.

    mysql> UPDATE [table name] SET Select_priv = ‘Y’,Insert_priv = ‘Y’,Update_priv = ‘Y’ where [field name] = ‘user’;

    Delete a row(s) from a table.

    mysql> DELETE from [table name] where [field name] = ‘whatever’;

    Update database permissions/privilages.

    mysql> flush privileges;

    Delete a column.

    mysql> alter table [table name] drop column [column name];

    Add a new column to db.

    mysql> alter table [table name] add column [new column name] varchar (20);

    Change column name.

    mysql> alter table [table name] change [old column name] [new column name] varchar (50);

    Make a unique column so you get no dupes.

    mysql> alter table [table name] add unique ([column name]);

    Make a column bigger.

    mysql> alter table [table name] modify [column name] VARCHAR(3);

    Delete unique from table.

    mysql> alter table [table name] drop index [colmn name];

    Load a CSV file into a table.

    mysql> LOAD DATA INFILE ‘/tmp/filename.csv’ replace INTO TABLE [table name] FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’ (field1,field2,field3);

    Dump all databases for backup. Backup file is sql commands to recreate all db’s.

    # [mysql dir]/bin/mysqldump -u root -ppassword --opt >/tmp/alldatabases.sql

    Dump one database for backup.

    # [mysql dir]/bin/mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql

    Dump a table from a database.

    # [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

    Restore database (or database table) from backup.

    # [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

    Create Table Example 1.

    mysql> CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));

    Create Table Example 2.

    mysql> create table [table name] (personid int(50) not null auto_increment primary key,firstname varchar(35),middlename varchar(50),lastnamevarchar(50) default ‘bato’);

    MYSQL Statements and clauses

    ALTER DATABASE
    
    ALTER TABLE
    
    ALTER VIEW
    
    ANALYZE TABLE
    
    BACKUP TABLE
    
    CACHE INDEX
    
    CHANGE MASTER TO
    
    CHECK TABLE
    
    CHECKSUM TABLE
    
    COMMIT
    
    CREATE DATABASE
    
    CREATE INDEX
    
    CREATE TABLE
    
    CREATE VIEW
    
    DELETE
    
    DESCRIBE
    
    DO
    
    DROP DATABASE
    
    DROP INDEX
    
    DROP TABLE
    
    DROP USER
    
    DROP VIEW
    
    EXPLAIN
    
    FLUSH
    
    GRANT
    
    HANDLER
    
    INSERT
    
    JOIN
    
    KILL
    
    LOAD DATA FROM MASTER
    
    LOAD DATA INFILE
    
    LOAD INDEX INTO CACHE
    
    LOAD TABLE...FROM MASTER
    
    LOCK TABLES
    
    OPTIMIZE TABLE
    
    PURGE MASTER LOGS
    
    RENAME TABLE
    
    REPAIR TABLE
    
    REPLACE
    
    RESET
    
    RESET MASTER
    
    RESET SLAVE
    
    RESTORE TABLE
    
    REVOKE
    
    ROLLBACK
    
    ROLLBACK TO SAVEPOINT
    
    SAVEPOINT
    
    SELECT
    
    SET
    
    SET PASSWORD
    
    SET SQL_LOG_BIN
    
    SET TRANSACTION
    
    SHOW BINLOG EVENTS
    
    SHOW CHARACTER SET
    
    SHOW COLLATION
    
    SHOW COLUMNS
    
    SHOW CREATE DATABASE
    
    SHOW CREATE TABLE
    
    SHOW CREATE VIEW
    
    SHOW DATABASES
    
    SHOW ENGINES
    
    SHOW ERRORS
    
    SHOW GRANTS
    
    SHOW INDEX
    
    SHOW INNODB STATUS
    
    SHOW LOGS
    
    SHOW MASTER LOGS
    
    SHOW MASTER STATUS
    
    SHOW PRIVILEGES
    
    SHOW PROCESSLIST
    
    SHOW SLAVE HOSTS
    
    SHOW SLAVE STATUS
    
    SHOW STATUS
    
    SHOW TABLE STATUS
    
    SHOW TABLES
    
    SHOW VARIABLES
    
    SHOW WARNINGS
    
    START SLAVE
    
    START TRANSACTION
    
    STOP SLAVE
    
    TRUNCATE TABLE
    
    UNION
    
    UNLOCK TABLES
    
    USE
    

    String Functions

    AES_DECRYPT
    
    AES_ENCRYPT
    
    ASCII
    
    BIN
    
    BINARY
    
    BIT_LENGTH
    
    CHAR
    
    CHAR_LENGTH
    
    CHARACTER_LENGTH
    
    COMPRESS
    
    CONCAT
    
    CONCAT_WS
    
    CONV
    
    DECODE
    
    DES_DECRYPT
    
    DES_ENCRYPT
    
    ELT
    
    ENCODE
    
    ENCRYPT
    
    EXPORT_SET
    
    FIELD
    
    FIND_IN_SET
    
    HEX
    
    INET_ATON
    
    INET_NTOA
    
    INSERT
    
    INSTR
    
    LCASE
    
    LEFT
    
    LENGTH
    
    LOAD_FILE
    
    LOCATE
    
    LOWER
    
    LPAD
    
    LTRIM
    
    MAKE_SET
    
    MATCH    AGAINST
    
    MD5
    
    MID
    
    OCT
    
    OCTET_LENGTH
    
    OLD_PASSWORD
    
    ORD
    
    PASSWORD
    
    POSITION
    
    QUOTE
    
    REPEAT
    
    REPLACE
    
    REVERSE
    
    RIGHT
    
    RPAD
    
    RTRIM
    
    SHA
    
    SHA1
    
    SOUNDEX
    
    SPACE
    
    STRCMP
    
    SUBSTRING
    
    SUBSTRING_INDEX
    
    TRIM
    
    UCASE
    
    UNCOMPRESS
    
    UNCOMPRESSED_LENGTH
    
    UNHEX
    
    UPPER
    

    Date and Time Functions

    ADDDATE
    
    ADDTIME
    
    CONVERT_TZ
    
    CURDATE
    
    CURRENT_DATE
    
    CURRENT_TIME
    
    CURRENT_TIMESTAMP
    
    CURTIME
    
    DATE
    
    DATE_ADD
    
    DATE_FORMAT
    
    DATE_SUB
    
    DATEDIFF
    
    DAY
    
    DAYNAME
    
    DAYOFMONTH
    
    DAYOFWEEK
    
    DAYOFYEAR
    
    EXTRACT
    
    FROM_DAYS
    
    FROM_UNIXTIME
    
    GET_FORMAT
    
    HOUR
    
    LAST_DAY
    
    LOCALTIME
    
    LOCALTIMESTAMP
    
    MAKEDATE
    
    MAKETIME
    
    MICROSECOND
    
    MINUTE
    
    MONTH
    
    MONTHNAME
    
    NOW
    
    PERIOD_ADD
    
    PERIOD_DIFF
    
    QUARTER
    
    SEC_TO_TIME
    
    SECOND
    
    STR_TO_DATE
    
    SUBDATE
    
    SUBTIME
    
    SYSDATE
    
    TIME
    
    TIMEDIFF
    
    TIMESTAMP
    
    TIMESTAMPDIFF
    
    TIMESTAMPADD
    
    TIME_FORMAT
    
    TIME_TO_SEC
    
    TO_DAYS
    
    UNIX_TIMESTAMP
    
    UTC_DATE
    
    UTC_TIME
    
    UTC_TIMESTAMP
    
    WEEK
    
    WEEKDAY
    
    WEEKOFYEAR
    
    YEAR
    
    YEARWEEK
    

    Mathematical and Aggregate Functions

    ABS
    
    ACOS
    
    ASIN
    
    ATAN
    
    ATAN2
    
    AVG
    
    BIT_AND
    
    BIT_OR
    
    BIT_XOR
    
    CEIL
    
    CEILING
    
    COS
    
    COT
    
    COUNT
    
    CRC32
    
    DEGREES
    
    EXP
    
    FLOOR
    
    FORMAT
    
    GREATEST
    
    GROUP_CONCAT
    
    LEAST
    
    LN
    
    LOG
    
    LOG2
    
    LOG10
    
    MAX
    
    MIN
    
    MOD
    
    PI
    
    POW
    
    POWER
    
    RADIANS
    
    RAND
    
    ROUND
    
    SIGN
    
    SIN
    
    SQRT
    
    STD
    
    STDDEV
    
    SUM
    
    TAN
    
    TRUNCATE
    
    VARIANCE
    

    Flow Control Functions

    CASE
    
    IF
    
    IFNULL
    
    NULLIF
    

    Command-Line Utilities

    comp_err
    
    isamchk
    
    make_binary_distribution
    
    msql2mysql
    
    my_print_defaults
    
    myisamchk
    
    myisamlog
    
    myisampack
    
    mysqlaccess
    
    mysqladmin
    
    mysqlbinlog
    
    mysqlbug
    
    mysqlcheck
    
    mysqldump
    
    mysqldumpslow
    
    mysqlhotcopy
    
    mysqlimport
    
    mysqlshow
    
    perror
    

    Perl API - using functions and methods built into the Perl DBI with MySQL

    available_drivers
    
    begin_work
    
    bind_col
    
    bind_columns
    
    bind_param
    
    bind_param_array
    
    bind_param_inout
    
    can
    
    clone
    
    column_info
    
    commit
    
    connect
    
    connect_cached
    
    data_sources
    
    disconnect
    
    do
    
    dump_results
    
    err
    
    errstr
    
    execute
    
    execute_array
    
    execute_for_fetch
    
    fetch
    
    fetchall_arrayref
    
    fetchall_hashref
    
    fetchrow_array
    
    fetchrow_arrayref
    
    fetchrow_hashref
    
    finish
    
    foreign_key_info
    
    func
    
    get_info
    
    installed_versions
    
    
    last_insert_id
    
    looks_like_number
    
    neat
    
    neat_list
    
    parse_dsn
    
    parse_trace_flag
    
    parse_trace_flags
    
    ping
    
    prepare
    
    prepare_cached
    
    primary_key
    
    primary_key_info
    
    quote
    
    quote_identifier
    
    rollback
    
    rows
    
    selectall_arrayref
    
    selectall_hashref
    
    selectcol_arrayref
    
    selectrow_array
    
    selectrow_arrayref
    
    selectrow_hashref
    
    set_err
    
    state
    
    table_info
    
    table_info_all
    
    tables
    
    trace
    
    trace_msg
    
    type_info
    
    type_info_all
    
    Attributes for Handles
    

    PHP API - using functions built into PHP with MySQL

    mysql_affected_rows
    
    mysql_change_user
    
    mysql_client_encoding
    
    mysql_close
    
    mysql_connect
    
    mysql_create_db
    
    mysql_data_seek
    
    mysql_db_name
    
    mysql_db_query
    
    mysql_drop_db
    
    mysql_errno
    
    mysql_error
    
    mysql_escape_string
    
    mysql_fetch_array
    
    mysql_fetch_assoc
    
    mysql_fetch_field
    
    mysql_fetch_lengths
    
    mysql_fetch_object
    
    mysql_fetch_row
    
    mysql_field_flags
    
    mysql_field_len
    
    mysql_field_name
    
    mysql_field_seek
    
    mysql_field_table
    
    mysql_field_type
    
    mysql_free_result
    
    mysql_get_client_info
    
    mysql_get_host_info
    
    mysql_get_proto_info
    
    mysql_get_server_info
    
    mysql_info
    
    mysql_insert_id
    
    mysql_list_dbs
    
    mysql_list_fields
    
    mysql_list_processes
    
    mysql_list_tables
    
    mysql_num_fields
    
    mysql_num_rows
    
    mysql_pconnect
    
    mysql_ping
    
    mysql_query
    
    mysql_real_escape_string
    
    mysql_result
    
    mysql_select_db
    
    mysql_stat
    
    mysql_tablename
    
    mysql_thread_id
    
    mysql_unbuffered_query
    
    Linux Systems Guides

  • Basic Linux Terminal Commands
    rickR rick

    Listing directory contents

    ls - To list the contents of a directory

    Usage: ls [flags]

    Example: ls (To list the current directory)

    Example: ls /tmp (To list the contents of /tmp)

    Example: ls -a (To list hidden files)

    Example: ls -l (To list file/directory permissions and file sizes)

    Example: ls -al /tmp(To list all files and permissions in /tmp)

    Example: ls -il (To get the inode number, permissions, owner, file sizes, UID and timestamps of all files in current directory)

    For more information, in a terminal, type man ls

    Linux Systems Guides

  • Basic Linux Terminal Commands
    rickR rick

    Deleting files

    To delete a file you must first have write permission to it. Once you have write permission, in a terminal run:
    rm filename\

    There is no “Recycle Bin” in Linux so once you delete a file, it’s gone for good.

    Being safe, find the files first and actually look at what you will be deleting! find . -type f -name foo\*

    When removing files, you may use an astrix “*” as a wildcard flag to remove certain files, for example if I wanted to remove all files that began with “foo” , I would run:

    find . -type f -name foo\* -exec rm {} \;

    If anyone tells you to run rm -rf / as root, DO NOT LISTEN TO THEM. Running this command will delete all the files/directories on your Linux system. And render the machine completely useless with zero chance of recovery!


    You should not be running as root to begin with! Learn to use a secondary user, and as well the “su” command or “Super User” as general usage dictates.


    Deleting directories
    If you have ownership to the directory and the directory is empty, you can simply type

    rmdir directoryname to remove the directory.

    If the directory is not empty and you wish to simply delete it and all its contents, run:

    rm -rf directoryname\[/code\] Please be careful with the -rf flag, as it will remove everything in the specified directory including sub directories. With root access and the rm -rf command you can wipe out your entire system if you make an error.

    Linux Systems Guides

  • Basic Linux Terminal Commands
    rickR rick

    Editing files
    The default editor installed with most all distros of linux is VIM , or

    vi filename

    Vim is an advanced command line editor, you should consider learning the commands.

    You can however also use nano To edit a file with nano, simply run:

    nano filename

    This will open up the file and allow to you edit the file. At the bottom of the screen you will notice the various commands that you have access to with nano. If you wish to save the file and exit, simply hold down the control key and hit the x key on your keyboard.

    You will be asked to confirm this edit, if you have permissions to do so, once you confirm by typeing y, the file will be edited and nano will exit.

    Linux Systems Guides

  • Basic Linux Terminal Commands
    rickR rick

    Renaming files
    mv - Command used to move or rename files
    Usage: mv file location
    Usage: mv filename::newfilename

    Example: mv tmp/site-logo.png /tmp/lime-it.png

    Read the manual: man mv


    Moving files
    mv - Used to move or rename files
    Usage: mv file location (to move)

    Example:mv index.html /var/www/index.html

    For more information, in a terminal and read the manual pages, type: man mv

    Linux Systems Guides

  • Basic Linux Terminal Commands
    rickR rick

    Downloading a file using the terminal command wget

    First cd to the tmp directory

    cd /tmp

    Example: wget http://news.lime-it.us/uploads/system/site-logo.png


    Copy files

    cp - Used to copy files or directories from one location to another. We can use the above example for this.

    Example: cp /tmp/site-logo.png /var/www/httpdocs

    [as httpdocs is your root web directory]


    To move ALL files from one directory to another:

    Example: cp /tmp/files/* /var/www/httpdocs

    (the “*” tells the machine to copy everything in /tmp/files to /var/www/)


    Check your man pages for more information on the cp command**

    man cp

    Linux Systems Guides

  • Basic Linux Terminal Commands
    rickR rick

    Adding a user
    While logged in as root, type in the shell:

    replace username with the username you wish

    adduser username
    

    Deleting a user:
    While logged in as root, type replace username with the user name you wish to delete.

    userdel username
    

    Change login password
    To set the password for a specific user, replace username with the name of the user. By typing simply:

      passwd username
    

    To change the current password for the user you are logged in as:

    passwd
    

    Change directories

    cd - Used to Change Directories

    Usage: cd /[directory]
    Example:

    cd /tmp
    

    Example:

    cd ../
    

    (moves back one directory)

    Move to your home directory:

    cd
    

    Check the man pages for more info:

    man cd
    
    Linux Systems Guides
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post