To create the workspace folder and do the initial setup,
mkdir -p ~/<workspace_name>/src
As an example (we will be using this workspace from here on),
mkdir -p ~/ros_workshop/src
Enter the workspace and build it.
cd ~/ros_workshop/
catkin build
To create a package
cd ~/ros_workshop/src
catkin_create_pkg <package_name> [depend1] [depend2] [depend3]
As an example,
catkin_create_pkg session2_tutorials std_msgs rospy roscpp
To build the package,
catkin build
Note : Catkin build command gives a abstract view of the build process or incase it does not work,
catkin_make
command can be used. It comes as an inbuilt tool with ROS and gives a detailed output on the build process.
To setup new environment variables,
source devel/setup.bash