Tag Info

Hot answers tagged

4

Apparently one of your modifications to .bashrc introduced an error that treats /bin like something other than a directory (for example, by trying to run it as an executable file, read data from or write data to it as a file, etc.). Because .bashrc runs when your interactive shell starts, the error message always appears. You may be able to identify the ...


4

If your goal is to execute a one-line command that: Removes and recreates the directory ~/Desktop/foo if it already exists. Just creates the directory ~/Desktop/foo if it does not already exist. Then you can use: rm -r ~/Desktop/foo; mkdir ~/Desktop/foo ; is equivalent to a newline, but it lets you execute multiple commands on a single line (i.e., as ...


3

No, there is no single command to do what you are asking. Why? This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together.1 In this instance, the mkdir and rm commands do what you require, and work well together, since rm -r will delete the directory as well, so a subsequent mkdir will create ...


3

You can simply use (1) chmod a-w directory which will make the directory unwritable to everyone. To give write access to all users: chmod a+w directory For more fine access, there is a nice tutorial on Unix permissions here; if you need even more fine-grained control, you can use Access Control Lists (this last link is for Arch Linux, but works on ...


2

From man unrar -p<password> Set password. So your line would be something like: for file in *.part01.rar; do unrar x -p<password> ${file}; done;


2

The command to remove a directory is rm. So you need 2 commands. rm -r ~/Desktop/foo/ mkdir ~/Desktop/foo/ As shown in comments you can chain them with ; (= do both even if 1st fails) or && (= only mkdir when the rm does not fail). The -r is for removing dirs. The 1st command also removes ALL contents of the directory. If that is NOT your ...


1

You need to quote the exclude pattern, as you already tried to do; The first one should actually work, even if there is a "nicer" solution. But let's look at a simplified example to work with; I Created some directories with files with .foo and .bar extensions: Here I run find to list my test directory - it shows all files and directories: $ find . ...


1

I have done this before, with no negative effects. I have a set of virtual servers and I log in to them by authenticating with LDAP. Some of the VMs are not configured correctly and don't create a home directory when a new LDAP user logs in. So in the past I have logged in, created a directory in /home that matches my username. Then when I log back in it ...


1

A directory in /home is just like any other directory. Without a corresponding entry in the passwd database (whether the file itself or in AD) it has no special status. I have made directories there by accident (a cd too many) with no side effects. Of course, for all our LDAP users we create the home directories manually in the NFS server, copy over ...


1

Create a group for the purpose: sudo addgroup --system guests Make the temporary guest users be added to that group by editing or creating the file /etc/guest-session/prefs.sh and adding this line: adduser $USER guests Create the directory /var/guest-data like this: sudo mkdir -m 2775 /var/guest-data sudo chgrp guests /var/guest-data See also the ...


1

If the applications are to be used by all the user in the system, the /usr/local tree is the ideal place; no package should put files there (it is for software you are compiling yourself), but the directory /usr/local/lib is in the default path for the dinamyc loader. (see /etc/ld.so.conf.d/libc.conf). I normally even move the /usr/local tree under /home ...


1

Every directory has a link to itself and its parent (that's why . of an empty directory will have a link count of 2). But because every directory links to its parent, any directory that has a subdirectory will have a link from that child. Thus the link count of a directory is 2 + the number of directories immediately contained by it.


1

You're nearly right. /tmp is better practice: #!/bin/bash while: # Go forever. ls /media/<USERNAME>/ > /tmp/media.diff sleep 10 ls /media/<USERNAME>/ > /tmp/mediacompare.diff diff /tmp/media.diff /tmp/mediacompare.diff done


1

Assuming you have a folder that contains only project folders, you could run the following in that folder: for proj in *; do phpfiles=$(find $proj -iname '*.php') size=$(du -ch $phpfiles | tail -n 1 | cut -d\t -f1) echo $proj $size done Explanation: we iterate over all project folders. In each folder, we find all *.php files. We compute the total ...


1

pushd with no arguments swaps the top two entries on the stack, allowing you to effectively cd back and forth between them. Starting out in d1, execute pushd d2 adds d1 and d2 to the stack and leaves you in d2. Execute pushd again with no arguments, and you're back in d1 with d1 and d2 reversed on the stack.


1

It is true that you won't use system memory but the fact you don't use cpu in your exemple is only because you don't read the pipe so the process is waiting. Consider this exemple : $ mkfifo /tmp/testpipe $ tar cvf - / | gzip > /tmp/testpipe Now open a new console and run this : $ watch -n 1 'ps u -P $(pidof tar) Open a third console and type : $ ...


1

LittleByBlue is correct that that is the easiest method. I myself would rename both to "Main Drive 1" and "Main Drive 2". The problem is, every time I restart Ubuntu, it chooses randomly which partition to rename. That is normal for USB mounting. We use UUIDs to fix this problem. See the wiki UsingUUID about this (these UUIDs are edited into ...


1

You need to edit /usr/share/gnome-background-properties/trusty-wallpapers.xml, which is a real pain, especially with lots of long file names. It's easier to leave the pictures in the Pictures folder and direct Appearance to that with the drop down menu (set on Wallpapers by default). I don't know if you can create a sub folder in Pictures that ...



Only top voted, non community-wiki answers of a minimum length are eligible