How to Display top Results Sorted by Memory Usage?
To display the “top” command result sorted by memory usage, run the “top” in the terminal and press the “Shift + M” from the keyboard to sort it.
To display the “top” command result sorted by memory usage, run the “top” in the terminal and press the “Shift + M” from the keyboard to sort it.
To add any user to the existing group, use the “userrmod” command with the syntax “sudo usermod -a -G [Group Name] [User Name]”.
To execute the “sudo” command without a password append the “Sudoers” file by adding “username ALL=(ALL) NOPASSWD:ALL” password configuration.
To install dependencies automatically with the dpkg package manager, users can execute the “sudo apt install -f” command in the terminal.
To unzip the “.tgz” file in the Linux terminal, utilize the “tar”, and “gunzip”, commands. They required the zip file to have the “.tgz” extension.
To generate random strings in Linux, use the “Random Number Generator”, “OpenSSL library”, “UUID generator”, and “mktemp” commands.
The journalctl is the built-in utility to retrieve systemd logs with respect to time, service, boot-time, Kernel-related tasks, etc.
To remove PostgreSQL from the system, remove all the packages of PostgreSQL by listing them. After that remove the directories and PostgreSQL users as well.
To use the OR condition in the grep command, specify the patterns separated with “\”, or use the Flags “E” or “e” in the given syntax.
To enable the dark mode in the LibreOffice application access the “Options” window from the “Tools” menu list and select “dark” in the “Colour Scheme” section.
To make the chown recursive, use the syntax “chown -R [Mode] [Directory/Path]” for changing the ownership, or “chown -R :[Gorup] [Directory/Path]” for the group.
In Linux, Hard Disk Drives partitions can be viewed using “fdisk”, “cfdisk”, “lsblk”, and “parted” command line utilities or the “Disks” application.
To upgrade Docker on Ubuntu, first, uninstall docker’s old version. Then, download and install the latest Docker package from the official Docker repository.
The Python nested list or list of lists is created using the square bracket notation and can be accessed using the index position.
To get the current date and time in Python, different functions of the datetime and time modules are used, such as date.today(), datetime.now(), etc.
The Python one-line “if”, “if-else” and “if-elif-else” statements are created using the ternary operator or conditional expression.
The “for-in” expression, “list comprehension” and “map()” function is used to perform the “foreach” loop on every element of the given iterator in Python.
The “df.replace()” function is used to replace single or multiple values with single or multiple new values in pandas DataFrame in Python.
The “open()” function is used with the “w” mode to create a file with writing permissions or use the open() function with “x” mode to create an empty file.
The “json.load()” and “json.loads()” functions are used to parse JSON data in Python objects such as dictionaries, lists, etc.
The “strftime()” function is used to represent the DateTime in string format based on the specific standard directives/character codes.
To open a file in Python, the “open()” function is used. A file can be opened in various modes such as read mode, write mode, append mode, etc.
The “df.corr()”, “sn.heatmap()”, and “plt.show()” functions are used to create, represent, and plot correlation matrix in Python.
To find the array length the “len() function”, “array.size” attribute, “for loop”, “array.shape” attribute, and “length_hint()” functions are used in Python.
To convert a list or list of lists to a Numpy array the “numpy.array()” function and the “numpy.asarray()” function is used in Python.
To convert the JSON string to CSV the “pd.read_json()” and “df.to_csv()” functions of the Pandas module are used in Python.
To add elements to an array the “insert()” function, “+ operator”, “append()” function, and “extend()” function is used in Python.
To uninstall MySQL in Ubuntu, remove the “mysql-server”, “mysql-client” and “mysql-common” packages from the operating system.
The reason for the error is that the source path is not specified. To fix this error, specify the source path and copy the file recursively.
The reasons for this error are, either the root password is not set or the password is being entered incorrectly. To fix this, change/set the root password.
To save the output of the terminal into a file, three methods are utilized which are Redirection Operator, tee utility, or script method.
In Linux, all the “.run” files can be installed by using the “chmod” command and the “Permissions” options to make them executable.
In Linux, the “echo”, “ps”, “lsof”, and “readlink” commands become handy to check the shell. The “/etc/passwd” file also provides valid login shells.
The “chmod +x
To unzip a .gz file without removing the original gzipped file, users can utilize the “gunzip”, “zcat” and “gzip” commands.
To change the password on the root user and user account in Linux, execute the “sudo passwd root” and “sudo passwd
The “firewall-cmd” command displays the firewall rules, allows a specific service, blocks a port, reloads the firewall, gets the firewall zone, and many more.
To install fonts on Ubuntu, use the “Font-Manager” application, add the font to the default font directory, or, manually create the font directory.
To set the date through the command line, utilize the “date”, “hwclock”, “timedatectl” and “ntpdate” commands by specifying the “YYYY-MM-DD hh:mm:ss” format.
The “export PATH=something:$PATH” command changes the “PATH” environment variable of the current system by specifying the path in the “something” variable.
To find all large files in the root filesystem, you can utilize the “find”, “du”, and “ncdu” commands. Also, you can specify the size limit, and sorting order.
To see the full log from systemctl status services, execute the “systemctl status service_name -l” command in the system.
Linux is a Unix-like operating system because it works on the same design and principle as Unix, but it is not the exact implementation of Unix.
Linux offers the “ls” command with “l”, “s”, and “h” options to view the file size along with detail in “long”, “sorting”, and “human-readable” format.
In Bash, the “eval” command evaluates its arguments as a shell script including “commands”, “variables”, “arithmetic expressions”, and “strings”.
To find the last login on Linux, use the “last”, “lastlog”, “/var/log/auth.log”, “who” and “lastb” commands that display username, terminal, date, and time.
The “chmod +x” makes the file/directory executable for all users while the “chmod 755” sets various types of permissions to the users.
To install the “tar.gz” files using sudo, extract the files, configure the binaries, then compile them, and lastly install the executable using sudo.
To install Linux Mint using VirtualBox, download the VirtualBox and create/customize the virtual machine. Read this post for a step-by-step procedure.
To install the latest Kernel on Ubuntu, use the “Mainline” tool or manually download the Debian files to update the Kernel.
Create the docker group (if it does not exist), add the particular user to the docker group, and then restart your computer to apply the changes.
The “random.choice()” and “random.choices()” functions are used in Python to select random items from single or multiple lists or sets.
To reverse an array in Python, the “reverse()” method, “reversed()” method, “flip()” method, and “Slicing” method are used.
To remove a character from the string the “replace()” function, “join()” function, “for” loop, “translate()” and string slicing methods are used in Python.
To print the simple array or numpy array the “print()” method and “for loop” method are used in Python. The “numpy.array()” function creates the numpy array.
To calculate the execution time of the Python program, use the “time” module, “timeit” module, “datetime” module, and “time.process_time_ns()” function.
To find the max int, the “sys.maxsize()” and “np.iinfor()” functions are used in Python. The “~sys.maxsize” is used to find the minimum integer.
To iterate through the list, the for loop, list comprehension, Loop with range() function, While loop, enumerate(), and lambda functions are used in Python.
The TTY is a character-based device used as a medium for entering data, still a crucial part of the operating systems but in software form.
To resolve ConnectionError in Python, various fixes are used such as checking the URL, using a retry object, try-except, and maintaining a stable connection.
To get timestamps in Python, the “datetime”, “calendar”, and “time” modules are used. The “datetime” module can be used to convert timestamps into DateTime.
To display the images in Python, the “Pillow” module, the “OpenCV” module, the “Scikit-Image” module, the “Matplotlib” module, and the “Tensorflow” are used.
To create the list of tuples in Python, the “square bracket[]”, “map()” function, “zip()” function, and the List Comprehension method are used.
To concatenate two lists the “+ Operator”, “extend()” function, “itertools.chain()” function, “the ‘*operator” and list comprehension is used in Python.
To generate random strings and passwords using upper and lower case letters, digits, symbols, etc. the random and string modules are used in Python.
The “randrange()” and “randint()” functions are used to generate the random integers within the specified range in Python.
The “random.random()” function and “random.uniform()” function is used in Python to generate the random float number within the specified range.
To write the list to a file, the “write()” function, “writelines()” function, “JSON”, and “Pickle” modules are used in Python.
In Python, the square brackets[], np.empty() function, and list comprehension method are used to initialize or create an array.
To check if a file exists at the given path the “os.path.exists()” function, “os.path.isfile()” function, and “pathlibPath.exists()” function is used in Python.