Answers for "unix commands"

19

linux commands

Linux Commands (Case Sensitive):

Basic:
pwd                ==> print the name of current directory   || Ex: pwd
whoami             ==> print the current user                || Ex: whoami
cd [directoryName] ==> enter a directory               		 || Ex: cd Music
cd ..              ==> go back to the parent directory       || Ex: cd ..
cp [file]          ==> copy file                             || Ex: cp music.mp3
ls                 ==> list all items in the current folder  || Ex: ls
clear              ==> clears the terminal                   || Ex: clear
mkdir [foldername] ==> makes folder with the specified name  || Ex: mkdir Songs
rmdir [foldername] ==> removes the specified folder          || Ex: rmdir Songs
echo [param]       ==> outputs the value of the variable	 || Ex: echo "Hi"
					   or string to stdout		             
tree 			   ==> lists the files in the current		 || Ex: tree 
					   directory in tree like format 

For sorting files:
mv [file] [newname]==> rename a file or folder  			 || Ex: mv exe txt
cat [filename]     ==> reads the specified file              || Ex: cat cmds.txt
tac [filename]     ==> reads the specified file in reverse   || Ex: tac cmds.txt
tail [file, file]  ==> reads first 10 lines of the files     || Ex: tail cmds.txt
zip [file, file]   ==> compresses the specified files        || Ex: zip files
vi [file]          ==> edit file in the terminal             || Ex: vi cmds.txt
gedit [file]       ==> edits the file in text editor         || Ex: gedit cm.txt
nano [file]        ==> edit file in nano editor              || Ex: nano cmds.txt
tar                ==> same as bzip2 						 || Ex: tar file
bzip2 -z / -d      ==> compress and decompress files with    || Ex: bzip2 -z cmds
                       the extension "bz2" respectively  
gzip               ==> same as bzip2 but compresses files    || Ex: gzip file
						with a gz extension.

Getting help:
man [command]      ==> show the manual of the command        || Ex: ls man
[command] --help   ==> similar to man but ouputs in terminal || Ex: pwd --help
apropos [word]     ==> search for the word in description    || Ex: aprpos list
					   of all commands

More advanced: 
reboot             ==> reboot the system                     || Ex: reboot
which [command]    ==> ouputs the location of the command    || Ex: which ls
su [username]      ==> impersonate as the specified user     || Ex: su root
id				   ==> print user and group information 	 || Ex: id
hostname		   ==>  display or seta computer`s hostname  || Ex: hostname
uname -a          ==> show  all the information of the OS    || Ex: uname -a
exit               ==> exit the current user or the terminal || Ex: exit
shutdown -P +min   ==> shutdowns the system        			 || Ex: shutdown -P

Networking: 
ifconfig           ==> lists all the network interfaces on   || Ex: ifconfig
					   your machine 
netstat            ==> displays network connections for TCP, || Ex: netstat
					   routing tables, and a number of 
                       network interface and network 
                       protocol statistic

For listing hardware:
lscpu             ==> list CPU architecture information      || Ex: lscpu
lsusb             ==> list information about usbs            || Ex: lsusb
lsblk 			  ==> list block devices					 || Ex: lsblk
lsof			  ==> list opened files						 || Ex: lsof
lspci       	  ==> list PCI devices  	 				 || Ex: lscpi

System Administration: 
  User Management:
  who 			     ==> prints the current logged in users  || Ex: who
  users              ==> shows names of users logged in      || Ex: users
  adduser [username] ==> adds another user                   || Ex: adduser david
  useradd [username] ==> same as adduser but is not preferrd || Ex: useradd david
  deluser            ==> deletes a user                      || Ex: deluser david
  usermod [user]	 ==> modify user settings & prefrences   || Ex: usermod david --shell /bin/bash
  passwd [user]      ==> change the password of the user	 || Ex: passwd  
  uptime             ==> shows how long the system has been  || Ex: uptime
                         running, number logged on users and 
                         the system load averages		
  visudo 			 ==> recommended way to edit   			 || Ex: sudo visudo
  						 /etc/sudoers file
  vipw 			     ==> recommended way to edit /etc/passwd || Ex: sudo vipw
  						 file
  systemctl 		 ==> mangae all the background running   || Ex: sudo systemctl disable ssh
  						 services (daemons)
  journalctl 		 ==> see all the logs for systemctl		 || journalctl -xe
  
  Important Files:
  /etc/passwd     ==> stores information of all the users	 || cat /etc/passwd
  /etc/shadow     ==> stores the hashed version of every 	 || cat /etc/passwd
					user`s password
   
ps(Process Status)==> displays currently-running processes   || Ex: ps
ss(Socket Status) ==> used to dump socket statistics and	 || Ex: ss
					  displays information
Posted by: Guest on January-26-2021
3

unix commands

ls	ls       -   Lists files in current directory
ls -alF	     -   List in long format
cd	         - change directory
cd tempdir   - Change directory to tempdir
cd..         - Move back one directory
mkdir        - Make a directory
rmdir        - Remove directory(Must be empty)
cp           - Copy File into Directory
rm           - Remove or Delete File
rm *.tmp     - Remove all file
mv           - Move or rename files
more         - Look at file, one page at a time
lpr          - Send file to printer
man          - Online help about command
passwd       - Change password
gzip         - Compress file
grep<str><files> - Find which files contain certain word
who          - Lists who is logged on your machine
history      - Lists command history
date         - Print out current date
whoami       - returns your username
pwd          - tell where currently you are
Posted by: Guest on January-14-2021
2

shell commands

compgen -c	#Check commands in Unix
help | more	#Check commands in Windows
Posted by: Guest on November-22-2020
3

linux commands

Linux Commands (case-sensitive)
reboot ==> reboots system
man ==> gives you instruction of the command - Ex:
"man reboot"
mikdir ==> Creates directory(folder)
cd ==> Change directory
Ls ==> List directory content
pwd ==> Print name of the current working directory. It
gives you the exact location; Ex: /home/Andy/Desktop
ll ==> Long list format
ls-la ==> Prints files and hidden file
clear ==> Clear screen
cd.. ==> Goes to the parent file (not the root file)
cd/ ==> Goes to the parent root file
cd~ ==> Goes to the home of the user file
grep ==> Prints a line matching a pattern
df-h ==> Prints the disk space usage top ==> Displays
linux tasks (like task manager)
Posted by: Guest on January-14-2021
0

Shell commands

awk # pattern scanning and processing language
basename # strip directory and suffix from filenames
bg # resumes suspended jobs without bringing them to the foreground
cat # print files
cd # change the shell working directory.
chmod # change file mode
chown # change file owner and group
crontab # maintain crontab files
curl # transfer a URL
cut # remove sections from each line of files
date # display or set date and time
dig # DNS lookup utility
df # report file system disk space usage
diff # compare files line by line
du # estimate file space usage
echo # display a line of text
find # search for files in a directory hierarchy
fg # resumes suspended jobs and bring them to the foreground
grep # print lines matching a pattern
kill # send a signal to a process
less # read file with pagination
ln # create links
ls # list directory contents
lsb_release # print distribution-specific information
lsof # list open files
mkdir # create
mv # move files
nc # arbitrary TCP and UDP connections and listens
netstat # print network connections, routing tables, interface statistics...
nice # execute a utility with an altered scheduling priority
nproc # print the number of processing units available
passwd # change user password
pgrep # look up processes based on name and other attributes
pkill # send signal to processes based on name and other attributes
printenv # print all or part of environment
pwd # print name of current/working directory
top # display Linux processes
tr # translate or delete characters
ps # report a snapshot of the current processes
rm # remove files or directories
rmdir # remove directories
rsync # remote file copy
scp # secure copy (remote file copy program)
sed # stream editor for filtering and transforming text
sleep # suspend execution for an interval of time
sort # sort lines of text file
ssh # OpenSSH SSH client (remote login program)
ssh-keygen # SSH key generation, management and conversion
su # substitute user identity
sudo # execute a command as another user
tail # output the last part of files
tar # manipulate archives files
tr # translate or delete characters
uname # Print operating system name
uniq # report or omit repeated lines
uptime # show how long system has been running
w # Show who is logged on and what they are doing
whereis # locate the binary, source, and manual page files for a command
which # locate a command
wc # print newline, word, and byte counts for each file
xargs # build and execute command lines from standard input
| # redirect standard output to another command
> # redirect standard output
< # redirect standard input
& # send process to background
Posted by: Guest on September-18-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language