Did you know FaceySpacey is one of the best Yii development shops in Manhattan, New York?

The Startup Incubator.
Your one stop social media shop
Resource Categories:
Technical
Non-Technical
Refer A Friend
Popular Articles
DEVELOPMENT TOOLS 2 - IDEs (Netbeans)
PHP 5 - HOW TO LEARN PROGRAMMING
Subscribe
-
Technical
-
Linux
-
LINUX COMMANDS 1 - USING THE LINUX COMMAND LINE LINUX COMMANDS 2 - MORE LINUX COMMANDS LINUX COMMANDS 3 - SHELL SCRIPTING (Bash) LINUX TOOLS 1 - CRON JOBS LINUX TOOLS 2 - DAEMONS LINUX TOOLS 3 - DOCUMENTATION (Doxygen) SERVER SETUP 1 - SETTING UP LAMP & AMAZON WEB SERVICES SERVER SETUP 2 - CONNECTING YOUR DOMAIN NAME TO YOUR APPLICATION DIRECTORY SERVER SETUP 3 - INSTALLING Yii & YOUR APPLICATION
- LINUX COMMANDS 2 - MORE LINUX COMMANDS
LINUX COMMANDS 2 - MORE LINUX COMMANDS
Let’s dive a little deeper into some more commands, building on what we just explored.
To list all users in the system open up the following file:
# vim /etc/passwd
If it’s not quite clear, the idea is Linux allows you to have multiple users. Remember in these tutorials we’ve been logging in as the “root” user, but you can also login as other users, which perhaps have less permission to read and edit files. If you have other developers in your team you will want to only give them access to the files they’re working on. Also note to more experienced linux users why i recommend using “root” to start: the reason is because it removes complication and makes it so new Linux users have less to learn. Eventually they’ll learn about using the “sudo” command to preface their commands. For now, guys, google what “sudo” is.
To create a group type:
# groupadd groupname
To list all user groups open up the /etc/group file:
# vim /etc/group
To list all a specific user’s groups type:
# groups username
To add a new user type:
# adduser username
To add new users to a group type (this will also create the user):
# useradd -G groupname,groupname,groupname, username
To add an already existing user to groups type:
# usermod -a -G groupname,groupname,groupname username
To change an existing user’s primary group type:
# usermod -g groupname username
The benefit of using groups is that you can designate permissions by group, and therefore give access (or remove access) to a folder for a many users all at the same time. That’s the general idea of groups in programming in genera--it allows you to do less work by making the code you write function on behalf of a group. Then you simply need a mechanism to assign users to groups. Above are the standard user grouping mechanisms of Linux.
To update your Ubuntu installation, type:
# apt-get update
To install an application (as you saw in the server Setup tutorials) type:
# apt-get install app-name
e.g:
# apt-get install lamp-server^
To backup and restore MySQL databases use the following commands. First backup:
# mysqldump -u user_name -pYourPassword database_name > backup-file.sql
That will log you into your MySQL application (aided by a complementary application called “mysqldump”) and make a backup of the database called “database_name” and save it in a file called “backup-file.sql” in your current working directory.
Now here’s how you restore that backup:
# mysql -u user_name -pYourPassword database_name < backup-file.sql
That will log you directly into MySQL and immediately restore the contents of “backup-file.sql” to the database named “database_name”.
One key gotcha about these commands which fooled me the first (and second and probably third) times I used them was that the “-p” parameter has the password attached to it with no space in between like the “-u” username parameter.
Another cool feature I’ll just describe now is you can actually log into remote databases on a different server and restore their contents into your own database on your server. For example:
# mysqldump -u remote_user_name -pRemotePassword -h remoteserver.com databasename | mysql -u local_user_name -pLocalPassword -C new_database_name
That will make a backup on the remote server and then “pipe” the results of that command via the “|” symbol into a second command, specifically the mysql command and create a new database and fill it with the results taken from the remote server.
Piping one command into another FYI is a key tool to use at the Linux command line. All these commands have output, and if that output is suitable as input to another command, just put a pipe in between. You can continue that process of “piping” one command to another as long as makes sense for what you’re trying to accomplish. You can also use an arrow (“>”) to pass any output to a text file or use the double arrow (“>>”) to append the text output at the end of the file without replacing what’s already there. That’s very useful for tracking the results of your commands.
Related Entries
- LINUX COMMANDS 1 - USING THE LINUX COMMAND LINE
- LINUX COMMANDS 2 - MORE LINUX COMMANDS
- LINUX COMMANDS 3 - SHELL SCRIPTING (Bash)
- LINUX TOOLS 1 - CRON JOBS
- LINUX TOOLS 2 - DAEMONS
- LINUX TOOLS 3 - DOCUMENTATION (Doxygen)
- SERVER SETUP 1 - SETTING UP LAMP & AMAZON WEB SERVICES
- SERVER SETUP 2 - CONNECTING YOUR DOMAIN NAME TO YOUR APPLICATION DIRECTORY
- SERVER SETUP 3 - INSTALLING Yii & YOUR APPLICATION
Comments

Popular Articles
- sales@faceyspacey.com
- 917-741-7981
CONTRACTING 2 - TOP 10 EASY SITE CREATOR TOOLS