Posts Tagged ‘FreeBSD Commands’

Create a new user and Change User Password

Saturday, September 18th, 2010

To Add a new user you can use adduser command, and it ask you for user information step by step.

To Change user password use passwd command

Example

#passwd Joo –> will let you change the password for user Joo.

#passwd  –> will let you change the password for current user.

FreeBSD view system log

Tuesday, March 9th, 2010

One of the daily operations as FreeBSD administrator is to check system log and system resources usage, also system logs are my favorite friend to debug and solve system problems.

Here  a summary list for commands used to check system log.

  1. cat /var/log/messages will display all the system log
  2. tail -f /var/log/messages will display the tail of system log, use Ctrl+C to exit.
  3. less /var/log/messages will display system log page by page, press Q to exit.
  4. cat /var/log/messages | grep error will display only the lines contain the keyword error.
  5. vi /var/log/messages use :q to exit vi viewer (vi is the default editor that comes with the UNIX operating)

Other important logs you should check:

  1. cat /var/log/auth.log | grep error
  2. cat /var/log/maillog | grep error

FreeBSD Commands

Sunday, March 7th, 2010

Here is summary list for FreeBSD commands usually need and use:

  1. #pwd : get the current directory.
  2. #whoami get current user.
  3. #ls : list the files, only file names will be listed , its like dir command in the DOS.
  4. #ls -l : list the files, with detail information about files like file permission, owner, group, date, and size  , its like dir command in the DOS.
  5. #cd : to change directory.
  6. #man command: get the manual syntax and usage for the given command.
  7. #man -k keyword: search the manual for the given keyword.
  8. #cat filename: view the contents of the given file.
  9. #locate filename: serach for the location of the given file, its very fast.
  10. #/usr/libexec/locate.updatedb: to update locate database lookup file.
  11. #ee filename: edit the given file.
  12. #shutdown -r now: reboot the server immediately.
  13. #su: switch the current user to the root user.
  14. #fetch url: to download a url using http of ftp.
  15. #cp oldfilename newfilename: copy a file or directory to a new one.
  16. #cp -R oldfilename newfilename: copy a file or directory to a new one and all sub directories.
  17. #rm filename : delete and remove a file or directory.
  18. #rm -R filename : delete and remove a file or directory and all sub directories.
  19. #mv oldfilename newfilename: move  file to a new location.
  20. #mv -R oldfilename newfilename: move  file to a new location and all sub directories.
  21. #find /size + 100000k search for files that is larger than 100000k.