Linux Command Ref

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

LINUX

Command Reference
Working with command-line sessions
Login to ESX Server from physical console Press Alt-F1
Login to ESX Server from remote workstation ssh username@hostname -OR- ssh hostname -l username
Gain superuser privilege su -

Run a command with root privileges sudo command_name (use full pathname if PATH not set)
Display the last commands you have executed history
Display command description man command_name

Display your command search path echo $PATH

Run a command stored in the current directory ./command_name

Determine the full path name of a command which command_name

File and directory commands


Display current working directory pwd

Change to a different directory cd directory_name

Move or rename a file mv existing_file new_name

Copy a file cp existing_file copy_name

Display contents of current working directory ls

Get a detailed directory listing of current working directory ls –l

Delete a file rm file_name

Display contents of a text file cat file_name

Display contents of a text file, one screenful at a time more file_name

Display the last few lines of a text file tail file_name

Display the last few lines of a text file in real time (useful for
tail -f file_name
displaying log files)

Search for text within a file grep pattern file_name

Editing text files


Launch the nano text editor nano –w file_to_edit

Launch the vi text editor vi file_to_edit

File ownerships and permissions


Change owner of file or directory chown new_owner filename

Change the group affiliation of file or directory chgrp new_group filename

Change permissions of file or directory chmod permissions filename

Working with users and groups


Display one’s own username and group memberships id

Display effective UID whoami

Display real UID who am i

Display information about users logged in w -OR- who


Display the last logged in users last

Add a service console user useradd username

Set/change a user’s password passwd username

Close unwanted user sessions fuser –l pty_device_name

Working with processes


List all running service console processes ps –ef

Map process IDs with open user ports fuser –k process/protocol (e.g. ssh/tcp)

Copyright © 2007 VMware, Inc. All rights reserved. EDU-VI3DSA-JA1

You might also like